[antlr-interest] help writing a grammar class for a statement

Joan Pujol joanpujol at gmail.com
Sun Mar 13 02:04:37 PST 2005


Only and idea:

In your example I think that you can use a syntactic predicate when
parsing identifiers in expression. And only consume the identifier if
the next token is not a '='.

Cheers,


On Sat, 12 Mar 2005 12:46:15 -0800, Daran Davis <darandavis at comcast.net> wrote:
>  
>  
> 
> Hello, 
> 
>   
> 
> I am new to antlr and have a question regarding writing grammar classes. I
> have a language which has no line continuation characters and no statement
> end characters. For example, the following statement need to be correctly
> parsed: 
> 
>   
> 
> Var1 = 2*(3+4)+ ( 
> 
>          6+4)/10 
> 
> Var2 = Var1/2 
> 
>   
> 
> How can I handle this with antlr? 
> 
>   
> 
> Thanks, 
> 
>   
> 
> DD 


-- 
Joan Jesús Pujol Espinar


More information about the antlr-interest mailing list