[antlr-interest] newbie request for help
Gavin Lambert
antlr at mirality.co.nz
Fri Dec 5 03:30:57 PST 2008
At 19:46 5/12/2008, Kenny Leung wrote:
>One of the problems lies in parsing something like this:
>
> {vids=^vids}
>
>which means a struct named "vids", which is composed of void *
>(^v), int, double, and short.
>
>After the "{", I need to interpret vids as a single token, and
>after the "=", I need to interpret the characters as separate
>tokens.
Nope, you don't :) Just treat it as one bigger token at the lexer
level, and then split it up at the parser level when creating the
AST or output. Much simpler.
(There are techniques for doing the split at the lexer level, but
for something like this I think it's more complicated than it's
worth.)
More information about the antlr-interest
mailing list