[antlr-interest] All say that literal strings in parser rules are doing harm. Why?

Stefan Mätje Stefan.Maetje at esd-electronics.com
Tue Feb 28 03:08:02 PST 2012


Dear list members,

often I read on this list that including literal strings in parser rules is 
not recommended. Doing this would provoke problems and make error reporting 
more difficult.

Could somebody explain the possible problems and drawbacks to me. All postings 
I found on the list so far sound a little bit vague to me.

Can somebody please point me to a discussion or example grammar where the pros 
and cons are displayed more thoroughly?

At the moment I have a somewhat mixed grammar file (around 1800 lines) with in 
part using lexer tokens and in part using string literals in the parser rules. 
Especially I do that if the keyword exists only in a single rule.

Regards,
	Stefan Mätje



More information about the antlr-interest mailing list