Re: Backtracking yacc

ipser@solomon.technet.sg (Ed Ipser)
Wed, 16 Sep 1992 02:55:30 GMT

          From comp.compilers

Related articles
Backtracking yacc jarmo@ksvltd.FI (Jarmo Raiha) (1992-09-10)
Re: Backtracking yacc ipser@solomon.technet.sg (1992-09-11)
Re: Backtracking yacc sasghm@unx.sas.com (Gary Merrill) (1992-09-11)
Re: Backtracking yacc sasghm@unx.sas.com (Gary Merrill) (1992-09-14)
Re: Backtracking yacc ipser@solomon.technet.sg (1992-09-16)
Re: Backtracking yacc bromage@mullauna.cs.mu.OZ.AU (1992-09-17)
Re: Backtracking yacc Jasper.Kamperman@cwi.nl (1992-09-17)
Re: Backtracking yacc sasghm@unx.sas.com (1992-09-17)
Re: Backtracking yacc diamond@jit081.enet.dec.com (18-Sep-1992 1420) (1992-09-18)
Re: Backtracking yacc harwood@progress.com (Tom Harwood) (1992-09-18)
Re: Backtracking yacc ipser@solomon.technet.sg (1992-09-19)
[7 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: ipser@solomon.technet.sg (Ed Ipser)
Organization: TECHNET, Singapore
Date: Wed, 16 Sep 1992 02:55:30 GMT
References: 92-09-062 92-09-074
Keywords: yacc, parse

Gary Merrill <sasghm@unx.sas.com> writes:
>Such tests can, of course, be performed in the lexical analyzer and you
>can use the results of these tests to drive the invocations of your
>parser.


With all due respect, this is not correct. Throwing the problem to the
lexical analyzer presupposes that the conlfict involves a lexeme; this, of
course, is not the general case.


Attaching conditional tests to productions instead of lexemes allows a
greater degree of freedom with respect to the definition of the language.
In particular, with tests on productions, you can introduce a
differentiation at any point in the language. For example, a production
which contains only nonterminals on the right hand side might be
conditioned on synthesized attributes of the right-hand-side elements,
inherited attributes, or arbitrary global variables or computations on any
of the above.


Note that this has nothing to do with LR vs. LL; any parser scheme can add
this capability.


Another source of disambiguation that has not been discussed is the use of
regular expression grammars. Because a regular expression collects more
syntax into a single production, it can, by virtue of the LR parsing
method, defer certain choices until a larger part of the input has been
processed. The result is a more natural, and less ambiguous grammar.


The LADE C++/AT utilizes all of these methods to parse C++.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.