[antlr-interest] Combining into single token
Terence Parr
parrt at cs.usfca.edu
Wed Aug 1 13:11:26 PDT 2007
On Aug 1, 2007, at 1:01 PM, Joel Shellman wrote:
> This grammar:
>
> grammar SimpleTest;
> options {
> output=AST;
> }
>
> root : 'a'+ 'D' 'a'+ 'D';
>
> If you input aaDaaD to this grammar, it will result in a tree of ^(nil
> a a D a a D). Each letter is a different node in the tree. How can I
> change this so that the above would result in ^(nil aaDaaD), with all
> the letters being just one token/node in the tree?
change root to ROOT and then have
root : ROOT ;
You get a one token tree then.
Ter
More information about the antlr-interest
mailing list