Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » IMP » Error Recovery in LPG
Error Recovery in LPG [message #7398] Fri, 28 September 2007 15:59
Eclipse User
Originally posted by: olegm.gmail.com

Hello,

[I have sent this mail also to LPG forum, but haven't received a reply yet]

I would like to understand how error recovery works in LPG:
* How much of this is implemented in LPG
http://jikes.sourceforge.net/documents/
* How does %Recovery directive and error productions behave in LPG
* What options/parameters affect error recovery
* Are there any good example grammars with error recovery
* How would I implement error handling strategy "skip until semicolon"
for C-like languages
* Is it possible to write an error recovery mechanism that would accept
almost any input and produce at least some AST?

One large LPG grammar is present in IMP
http://sourceforge.net/projects/eclipse-imp/
for X10 language (Java extension)
http://x10.sourceforge.net/x10home.shtml
It even has some error recovery rules, however it fails to recover
from a statement
X X X;
or if there is a extraneous '}' in the end of a file.

LPG provides as an option a back-tracking parser which can parse
ambiguous LALR(1) grammars. Is there a way to specify priorities
of rules as in
http://www.cs.queensu.ca/~thurston/kelbt/
In LPG grammar I have found syntax "::=?", however I wonder if
I could have more priority levels, eg based on their order in
the file. Also what is the exact behavior of priorities?

The reason I need priorities is as follows: Suppose we take a
deterministic LALR(1) grammar for a language and extend it with
a bunch of rules that model possible error recovery strategies, like
Block ::= { StmtList
Block ::= StmtList }
The resulting grammar would not be deterministic, however if the
backtracking parser tried first the rules of the initial grammar
and only later the error recovery rules we would a have a very
generic error recovery scheme. Do You think it would be a good idea?

Thank You in advance for Your answers,
Oleg Mürk
Previous Topic:Error Recovery in LPG
Next Topic:editing portions of a file
Goto Forum:
  


Current Time: Tue Sep 30 16:03:18 GMT 2014

Powered by FUDForum. Page generated in 0.03857 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software