[antlr-interest] On the Importance of Parentheses in Lexer Rules
Randall R Schulz
rschulz at sonic.net
Sun Nov 12 19:54:51 PST 2006
Hi,
I figured out the bizarre (to me, anyway) behavior of my lexer rules and
parser rules that directly reference lexer rules. E.g., it turns out
these two are very different:
name
: ( AtomicWord )
| ( SingleQuoted )
| ( UnsignedInteger )
;
name
: AtomicWord
| SingleQuoted
| UnsignedInteger
;
By parenthesizing all my lexer alternatives, my parser now is "working."
(I use the scare quotes because it's really too early to claim that,
but I'm certain I'm much closer than I was. I can get a successful
parse of much of my input corpus.)
Randall Schulz
More information about the antlr-interest
mailing list