[antlr-interest] optimization of output language - reducing
redundant information?
Oliver.Kowalke at infineon.com
Oliver.Kowalke at infineon.com
Thu Jan 12 23:07:16 PST 2006
Hello,
I have a parse (with AST) which translates from a own-defined language
to SQL (WHERE-clause for a special database model):
'X' :-> A = 1 AND B = 2
'Y' :-> A = 1 AND C = 'abc'
'X && Y' :-> A = 1 AND B = 2 AND A = 1 AND C = 'abc'
'X || Y' :-> A = 1 AND B = 2 OR A = 1 AND C = 'abc'
A = 1 is redundant (occurs two times). After reducing redundant
information the SQL-WHERE-clause would look like:
'X && Y' :-> A = 1 AND B = 2 AND C = 'abc'
'X || Y' :-> A = 1 AND (B = 2 OR C = 'abc')
How can I achieve such a reduction?
Should I use a two-step approach using an intermediate language?
With best regards,
Oliver
More information about the antlr-interest
mailing list