Related articles |
---|
Backtracking and parsing tools adrian@sartre.cs.rhul.ac.uk (A Johnstone) (2004-10-02) |
Re: Backtracking and parsing tools vbdis@aol.com (2004-10-04) |
Re: Backtracking and parsing tools tarvydas@attcanada.ca (Paul Tarvydas) (2004-10-09) |
Re: Backtracking and parsing tools cordy@mac.com (Jim Cordy) (2005-01-12) |
From: | "Jim Cordy" <cordy@mac.com> |
Newsgroups: | comp.compilers |
Date: | 12 Jan 2005 22:56:35 -0500 |
Organization: | http://groups.google.com |
References: | 04-10-021 |
Keywords: | parse |
Posted-Date: | 12 Jan 2005 22:56:35 EST |
The TXL language has full parser backtracking with generalized
lookahead guards using the special nonterminal forms "[see X]" (the
input stream lookahead from here *must* be parseable as an [X]) and
"[not X]" (the input stream lookahead from here must *not* be parseable
as an [X]). ("[X]" is TXL notation for the nonterminal "<X>".)
For example, the following nonterminal definition resolves the local
ambiguity between assignment statements and procedure calls using a
lookahead to see that we don't have a parseable assignment:
define procedure_call
[not assignment] [id] [opt arguments]
end define
Lookaheads can be arbitrary nonterminals since full backtracking is
used.
Jim
Return to the
comp.compilers page.
Search the
comp.compilers archives again.