Greetings!

On Thu, 2010-03-11 at 14:01 +1100, J. Matthew Pryor wrote:
> I am a total ANTLR newbie,

Welcome to the crowd!

...stuff snipped...

> so when I give it the input
> 
> true && true
> 
> despite the fact that I get the following consle messages
> 
> line 1:5 no viable alternative at input '&&'
> line 0:-1 no viable alternative at input '<EOF>'
> 
> My method band() gets called with 2 Boolean, both set to true
> 
... more snipped, sorry, trying to trim to the essence of my reply...

> relExpr returns [Object value]
>      :   e=expr {$value = $e.value;}
>          (   '>' e=expr {$value = gt($value,$e.value);}
>          |   '<' e=expr {$value = lt($value,$e.value);}
>          |   '>=' e=expr {$value = gte($value,$e.value);}
>          |   '<=' e=expr {$value = lte($value,$e.value);}
>          |   '==' e=expr {$value = eq($value,$e.value);}
>          |   '!=' e=expr {$value = neq($value,$e.value);}
>          )
>      ;
> 

the second operand of relExpr is not optional. so `true` all by itself
is NOT a valid relExpr.

I think you want to add a `?` meta-operator to make the second operand
optional.

Hope this helps...
   -jbb



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to