[antlr-interest] Fwd: imaginary nodes
Thomas Jackson
thomas.jackson.iii at gmail.com
Tue Oct 9 06:06:01 PDT 2007
Did my example contain that? If so, it was a mistake. I believe all
imaginary tokens MUST be declared in the tokens section.
On 10/8/07, Austin Hastings <Austin_Hastings at yahoo.com> wrote:
>
> Page 184 has the top few lines for the C- grammar. That includes a
> tokens section.
>
> Although I am curious as to how an imaginary token can be defined that
> is NOT in the tokens section?
>
> =Austin
>
>
> Thomas Jackson wrote:
> > Forgot to forward to group.....
> >
> > ---------- Forwarded message ----------
> > From: *Thomas Jackson* <thomas.jackson.iii at gmail.com
> > <mailto:thomas.jackson.iii at gmail.com>>
> > Date: Oct 8, 2007 5:17 PM
> > Subject: Re: [antlr-interest] imaginary nodes
> > To: Mark Volkmann <r.mark.volkmann at gmail.com
> > <mailto:r.mark.volkmann at gmail.com>>
> >
> > grammar T;
> >
> > options { output=AST; language=Java; }
> >
> > tokens {
> > PARAGRAPH;
> > SENTENCE;
> > NOUN;
> > VERB;
> > ADJECTIVE;
> > THIS="this";
> > IS="is";
> > A="a";
> > BAD="bad";
> > EXAMPLE="example";
> > }
> >
> > parse : THIS IS A BAD EXAMPLE -> ^( PARAGRAPH ^(SENTENCE ^(NOUN
> > EXAMPLE) ^(ADJECTIVE BAD) ^(VERB IS)))
> > ;
> > Hope this helps...
> >
> > Thanks
> > Thomas
> >
> >
> >
> > On 10/8/07, *Mark Volkmann* <r.mark.volkmann at gmail.com
> > <mailto:r.mark.volkmann at gmail.com>> wrote:
> >
> > In "The Definitive ANTLR Reference" chapter 7, page 166 of my
> printed
> > copy, in the discussion about adding imaginary nodes to an AST it
> says
> > "The imaginary token must be defined elsewhere in a grammar or in
> the
> > tokens section." I can't seem to find an example of where this is
> done
> > in the book though. Can someone give me an example of the syntax to
> > define an imaginary node in a grammar?
> >
> > --
> > R. Mark Volkmann
> > Object Computing, Inc.
> >
> >
> >
> >
> > --
> > Thomas Jackson
> >
> > --
> > Thomas Jackson
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.488 / Virus Database: 269.14.4/1057 - Release Date:
> 10/8/2007 9:04 AM
> >
>
>
--
Thomas Jackson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20071009/c294dd85/attachment.html
More information about the antlr-interest
mailing list