in reply to (OT) Yapp rules and resolving reduce/reduce errors
One way to deal with this is in a shift-reduce parser to break up your grammar into different nonterminals. Starting from the statement level down might help. Combining like nonterminals might, too.
table_and_column: ident '.' ident | ident ;
Then your statement can look something like:
(with suitable null options).statement: stmt_type from_into table_and_column set table_and_column where | stmt_type from_into table_and_column ... ;
There are open source and I think even public domain grammars for SQL. They should be available in both LL and LR. Perhaps you could start with one and translate it into YAPP instead of creating the grammar from scratch?
One such SQL grammar, written in the EBNF notation of the Gold Parsing System, is apparently Ansi 89 compliant.
|
|---|