[antlr-interest] Fwd: imaginary nodes

Austin Hastings Austin_Hastings at Yahoo.com
Tue Oct 9 06:11:08 PDT 2007


No, sir. I was referring to "The imaginary token must be defined 
elsewhere in a grammar or in the tokens section."

Thomas Jackson wrote:
> 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 
> <mailto: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>
>     > <mailto: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>
>     > <mailto: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>
>     > <mailto: 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
> ------------------------------------------------------------------------
>
> No virus found in this incoming message.
> Checked by AVG Free Edition. 
> Version: 7.5.488 / Virus Database: 269.14.6/1059 - Release Date: 10/9/2007 8:44 AM
>   



More information about the antlr-interest mailing list