[antlr-interest] Error nodes created upon syntax error

Johannes Luber jaluber at gmx.de
Mon Dec 3 10:54:57 PST 2007


Terence Parr wrote:
> 
> On Dec 3, 2007, at 5:05 AM, Johannes Luber wrote:
>> It makes sense, but what about single deletion/insertion in normal mode?
> 
> Well, i've been thinking.  I realize now that that mode is only of
> academic interest.  How can you execute actions without putting in
> guards against all possible input syntax errors?  That's what we call a
> parser. ;)  So, upon error in a rule, you must execute no further
> actions and immediately report error, recover, and return.

I agree. Will you use then the Strategy pattern in your changed source code?

>> How do we deal with an ERROR node in the next grammar? Or is then there
>> a way to emit an error message during the construction of the AST?
> 
> Well, presumably, you wouldn't pass the tree along to another
> grammar...it is malformed.

Better worded: How does this change affect the error recovery as
described in the book?

Johannes


More information about the antlr-interest mailing list