[antlr-interest] Another simple case (of confusion)

Norman Dunbar Norman at dunbar-it.co.uk
Fri Dec 16 08:02:38 PST 2011

Hi John,

> You did not show your parser rules so I can only guess, but does your
> top-most parser rule consume all of the input by requiring an EOF as its
> terminator?
Face-palm time! I didn't have a parser rule, only lexer rules. Silly me. 
I made up a quick rule as follows:

bin_assign : FLOAT_ID '=' BIN_VALUE ;

And now when I run the interpreter, I get that as a valid statement if 
all is well, and I'm not sure what when there are dots and other 
non-binary digits in the input:

fred = %1010.9 results in a tree as follows in the diagram:

Grammar T
   |   |   |
fred  =  %1010

So, it seems, at the moment, to be Ignoring the invalid characters. 
Running in the debugger gives me Java conmpilation errors - a missing 
semi-colon somewhere in the lexer.

Not to worry, I'm on holiday in 30 mins until the New Year. I'll worry 
about it then.

Thanks for your help.

Happy Christmas everyone. (Insert appropriate festival of choice here of 


Norman Dunbar
Dunbar IT Consultants Ltd

Registered address:
Thorpe House
61 Richardshaw Lane
West Yorkshire
United Kingdom
LS28 7EL

Company Number: 05132767

More information about the antlr-interest mailing list