Re: Grammar with precedence rules

haberg@matematik.su.se (Hans Aberg)
21 Mar 2002 21:58:42 -0500

          From comp.compilers

Related articles
Grammar with precedence rules haberg@matematik.su.se (2002-03-09)
Re: Grammar with precedence rules joachim_d@gmx.de (Joachim Durchholz) (2002-03-11)
Re: Grammar with precedence rules haberg@matematik.su.se (2002-03-17)
Re: Grammar with precedence rules mickunas@cs.uiuc.edu (Dennis Mickunas) (2002-03-17)
Re: Grammar with precedence rules joachim_d@gmx.de (Joachim Durchholz) (2002-03-19)
Re: Grammar with precedence rules haberg@matematik.su.se (2002-03-21)
Re: Grammar with precedence rules michaeldyck@shaw.ca (Michael Dyck) (2002-03-31)
| List of all articles for this month |

From: haberg@matematik.su.se (Hans Aberg)
Newsgroups: comp.compilers
Date: 21 Mar 2002 21:58:42 -0500
Organization: Mathematics
References: 02-03-043 02-03-068 02-03-077 02-03-110
Keywords: parse
Posted-Date: 21 Mar 2002 21:58:42 EST

joachim.durchholz@gmx.de wrote:
>Hmm... I must confess that I didn't fully understand what you're trying
>to achieve.


To a grammar/precedence pair (G, P), find a definition language L(G,
P). (Thus, independent of parsing algorithms.)


>One thing that could be done is to use a Tomita (Earley) parser and use
>the priorities to resolve any ambiguities. (Never having used such a
>parser, I can't say whether the parser will give you the information you
>need to trace the ambiguity to a rule though.)


So merely adding non-deterministic parsing algorithms will not help, if
the idea is to find the language in a manner independent of the parsing
algorithm.


>BTW I'm not sure whether it's a good idea. Prioritizing stuff means that
>you'll never see any unintentional ambiguities. And to make sure that
>there are no unwanted ambiguities left, you'll have to thoroughly
>understand the grammar, so you'll have to do it the hard way anyway.
>
>Or did I overlook something?


The idea is to define the language independent of the parsing algorithm so
that when the latter is changed, the parsing remains the same.


Unintentional ambiguities will of course be seen if one is not putting in
massive ad hoc precedence relations. -- There is never a way to design a
language so that the programmer use it prudently.


    Hans Aberg * Anti-spam: remove "remove." from email address.
                                    * Email: Hans Aberg <remove.haberg@member.ams.org>
                                    * Home Page: <http://www.matematik.su.se/~haberg/>
                                    * AMS member listing: <http://www.ams.org/cml/>


Post a followup to this message

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