[antlr-interest] grammar patterns/best practice?
Oliver Kowalke
oliver.kowalke at gmx.de
Mon Feb 18 21:34:58 PST 2008
Hello,
is a collection of patterns used in grammars avaialbe on the INet?
I mean patterns used in order to solve some kind of problems:
...
comparison_op
:
EQ | GE | GEQ | IEQ | LE | LEQ | NEQ
;
factor_op
:
STAR | SOLIDUS
;
term_op
:
PLUS | MINUS
;
...
condition
: boolean_term ( OR boolean_term )*
;
boolean_term
: boolean_factor ( AND boolean_factor )*
;
boolean_factor
: ( NOT )? predicate
;
predicate
:
value comparison_op value
;
value
:
term ( options{ greedy=true; } : term_op term )*
;
term :
factor ( options{ greedy=true; } : factor_op factor)*
;
factor
:
( sign ) ? unsigned_value
;
...
(used for logical and arithmetic operators).
best regards,
Oliver
More information about the antlr-interest
mailing list