[antlr-interest] Multiplication and pointers in C-style language

Benjamin Shropshire shro8822 at vandals.uidaho.edu
Tue Apr 8 14:45:03 PDT 2008


Jim Idle wrote:

> Why not just download the examples tar from the download page and 
> inspect the ANSI C grammar in there? In fact, you could just steal the 
> rules if you want.
>
> Jim
>
>  
>
That most likely won't work perfectly. I ran into this one a while ago 
and found that gcc (with C++) gets this one wrong in some cases. 
Admittedly I was putting a multiplication on the LHS so I really can't 
objects. The answer that gcc takes seems to assume that you will never 
have a multiplication as a statement or on the LHS of an assignment, but 
only as a sub expression or just a plain expression. If that assumption 
is valid then C would be a good place to start (IMHO) but keep in mind 
that the makers of gcc though they were ok there and for me they were 
wrong.


More information about the antlr-interest mailing list