[antlr-interest] Another parsing question
antlr at mirality.co.nz
Mon Aug 4 14:45:09 PDT 2008
At 08:45 5/08/2008, Carter Cheng wrote:
>Thanks everyone for the help thus far. This is likely another
>beginners question concerning the behavior of the lexer/parser
>interactions in ANTLRv3. The question I have is are the tokens
>requested by the parser context dependent? i.e. is a different
>(N)DFA constructed depending on which tokens the parser expects
>see in the stream or is there only 1 N(DFA) with a series of
Lexing is all done up front with no input from the parser at all.
>(a); // lookup the index 1 in the variable array a
>([ 1 : 2 ]); // construct a mapping value with key : value in
>case 1 : 2
>The question I have is how can ANTLRv3 know whether ]) is a
>token or two tokens?
Depends on how you've defined the lexer rules :) But normally
you'd want to define it as two tokens.
More information about the antlr-interest