HyriseSQLParser/src/lemon/lemon_parser.y

24 lines
494 B
Plaintext
Raw Normal View History

2014-10-17 16:26:06 +02:00
%include {
#include <assert.h>
#include <cstdlib>
#include "lib/Statement.h"
}
%syntax_error { printf("Lemon syntax error\n"); }
%extra_argument { Statement** result }
%token_type {const char*}
%type expr {Statement*}
%left PLUS MINUS .
start ::= prog.
prog ::= prog print NL .
prog ::= prog print .
prog ::= .
print ::= expr(a) . { *result = a; }
expr(a) ::= NUMBER . { a = new Statement(eSelect); }
expr(a) ::= expr(b) PLUS expr . { a = b; }