Posted 8 years ago by David
Avatar
Hi, I'm looking into ways to handle error recovery. So far if the parser finds an error, it just terminates, which is not very good. I want it to indicate an error, but be able to return to an error-less state so that it can continue parsing.

I've looked into other parser engines, and read up on the 'burke-fisher' recovery methods and so the general methods seem to point to that when a error is found, you either insert, substitute or delete a token.

Now I know that the semantic parser works with a clone of the token set, due to the threading stuff, but can I do the above 3 methods directly on the token set that is passed to the semantic parser?

I won't need to edit the actual tokens in the document...I just need to be able to edit them for error recover.

Any other advice on error recovery would be grateful also.

Thanks.

Comments (1)

Posted 8 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi David,

While you can't really modify the token stream (although you MAY be able to via a custom IRecursiveDescentLexicalParser that you pass to the semantic parser), what you typically do to perform error handling with the SyntaxEditor 4.0 grammar is to use the <- -> sort of syntax to inject error handling code. By default, if no <- -> code is specified, a "return false;" is injected. By just putting <- -> you will get the erroring code to continue on. You could insert any other custom error handling code there too.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 8 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.