Translating Version 3 to Version 4

52 views
Skip to first unread message

Robert Eberhart

unread,
Jul 2, 2013, 1:03:24 PM7/2/13
to antlr-di...@googlegroups.com
I have a number of fragments in an Oracle grammar that I'm trying to translate to ANTLR V4 with a target of C#.  The original target was C.  

These fragments have a basic format that looks like this:

r_unique : r='UNIQUE' { $r->setType($r, T_RESERVED); $r->user1 = T_RESERVED;  }  ;

UNIQUE: 'UNIQUE';

I cannot complete discern the intent here so that I can translate this to ANTLR v4.  From what I can tell, the author was creating a new fragment derived from UNIQUE.  He associates UNIQUE with the variable r and injects C code that sets the type of the fragment to the type of T_RESERVED.  I'm not sure where the author defines or gets user1 from.

If anyone has an idea of what the intent is here and can explain it to me, I would be appreciative.  

- Robert Eberhart

Terence Parr

unread,
Jul 2, 2013, 1:29:53 PM7/2/13
to antlr-di...@googlegroups.com
Hi. I think that the person was trying to say that in a particular context UNIQUE is a reserved word not a variable. there are better ways to handle this. I believe we have something about keywords as variables in the wiki (v3) or in the new book.

T

July 2, 2013 10:03 AM
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

hirntot...@gmail.com

unread,
Jul 3, 2013, 9:30:57 AM7/3/13
to antlr-di...@googlegroups.com
Thanks for the input. I was able to find that section in the book.

- Robert Eberhart

On Tuesday, July 2, 2013 1:29:53 PM UTC-4, the_antlr_guy wrote:
> Hi. I think that the
> person was trying to say that in a particular context UNIQUE is a
> reserved word not a variable. there are better ways to handle this. I
> believe we have something about keywords as variables in the wiki (v3)
> or in the new book.
>
>
>
> T
>
>
>
>
>
>
>
>
>
Reply all
Reply to author
Forward
0 new messages