[antlr-interest] help understanding the parsing error

Mikhail Kruk meshko at gmail.com
Fri May 11 08:29:36 PDT 2012


I have a very simple grammar (attached, but here's the relevant part):


start
	:	(simple_expression | dotted_identifier)*
	;

simple_expression
	:	'XYZ' 'HAHA'
	;

identifier
	:	ID	
   	;

dotted_identifier
	:	identifier ( DOT identifier )*
	;

It pretty much works as expected, accepting "XYZ HAHA", "BLAH.TEST"
and "ABC".  But when I try to parse "XYZ.A" or "A.XYZ" it gets
confused trying to apply simple_expression to 'XYZ'.  I don't
understand why this is happening.  Shouldn't backtracking tear right
through this?

Thanks!
-m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.g
Type: application/octet-stream
Size: 414 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20120511/f6e475cb/attachment.obj 


More information about the antlr-interest mailing list