summaryrefslogtreecommitdiffstats
path: root/kexi/doc/dev/kexisql_grammar_notes.txt
diff options
context:
space:
mode:
Diffstat (limited to 'kexi/doc/dev/kexisql_grammar_notes.txt')
-rw-r--r--kexi/doc/dev/kexisql_grammar_notes.txt62
1 files changed, 62 insertions, 0 deletions
diff --git a/kexi/doc/dev/kexisql_grammar_notes.txt b/kexi/doc/dev/kexisql_grammar_notes.txt
new file mode 100644
index 00000000..9f80ed69
--- /dev/null
+++ b/kexi/doc/dev/kexisql_grammar_notes.txt
@@ -0,0 +1,62 @@
+/* Jaroslaw Staniek:
+ TAKEN FROM his compiler's parser
+ AS EXAMPLE FOR LUCIJAN'S KEXISQL PARSER */
+
+
+
+exp: exp3 { $$->prn(); }
+ | exp OR exp3 { $$ = new NOpLog($1,OR,$3); $$->prn(); }
+ ;
+exp3: exp3n {/*default*/}
+ | exp3 AND exp3n { $$ = new NOpLog($1,AND,$3); }
+ ;
+exp3n: exp2 {/*default*/}
+ | NOT exp3n { $$ = new NOp1arg(NOT,$2); }
+ ;
+exp2: exp1 {/*default*/}
+ | exp1 op_rel exp1 { $$ = new NOpRel($1,$2,$3); }
+ ;
+exp1: exp0 {/*default*/}
+ | exp1 op_ar1 exp0 { $$ = new NOpAr($1,$2,$3); }
+ ;
+exp0: exp_poj {/*default*/}
+ | exp0 op_ar0 exp_poj { $$ = new NOpAr($1,$2,$3); }
+ ;
+
+
+
+
+* prior.2 - relational oper. */
+op_rel: '=' { $$='='; }
+ | '<' { $$='<'; }
+ | '>' { $$='>'; }
+ | "<=" { $$=REL_LESS_EQ; }
+ | ">=" { $$=REL_GREAT_EQ; }
+ | "<>" { $$=REL_NOT_EQ; }
+ ;
+/* prior.1 - arytmetic oper. +,- */
+op_ar1: '+' { $$='+'; }
+ | '-' { $$='-'; }
+ ;
+/* prior.0 - arytmetic oper. *,/ */
+op_ar0: '*' { $$='*'; }
+ | '/' { $$='/'; }
+ ;
+exp_single: single {/*default*/}
+ | '(' exp ')' { /*$$=new NOp1arg(0, $2);*/ $$=$2; }
+ | '-' exp_single %prec OP_MINUS { $$=new NOp1arg('-', $2); }
+ | '+' exp_single %prec OP_PLUS { $$=new NOp1arg('+', $2); }
+ ;
+single: const {/*default*/}
+ | variable {/*default*/ }
+ | function_call {/*default*/}
+
+const: CONST_BOOL { $$ = new NConstBool(yylval.bval); }
+ | CONST_INT { $$ = new NConstInt(yylval.ival); }
+ | CONST_STR { $$ = new NConstStr(yylval.sval); }
+ ;
+
+
+
+
+