[antlr-interest] Error nodes created upon syntax error

Terence Parr parrt at cs.usfca.edu
Mon Dec 3 10:19:22 PST 2007


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.

> 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.

Ter


More information about the antlr-interest mailing list