Re: Parsing Expression Grammar

George Neuner <gneuner2@comcast.net>
10 Sep 2005 12:37:50 -0400

          From comp.compilers

Related articles
[4 earlier articles]
Re: Parsing Expression Grammar pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2005-09-02)
Re: Parsing Expression Grammar owong@castortech.com (Oliver Wong) (2005-09-03)
Re: Parsing Expression Grammar pohjalai@cc.helsinki.fi (A Pietu Pohjalainen) (2005-09-07)
Re: Parsing Expression Grammar paul@highpersoft.com (Paul Mann) (2005-09-07)
Re: Parsing Expression Grammar wclodius@lanl.gov (2005-09-10)
Re: Parsing Expression Grammar cfc@shell01.TheWorld.com (Chris F Clark) (2005-09-10)
Re: Parsing Expression Grammar gneuner2@comcast.net (George Neuner) (2005-09-10)
Re: Parsing Expression Grammar DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-09-10)
Re: Parsing Expression Grammar paul@parsetec.com (Paul Mann) (2005-09-11)
Re: Parsing Expression Grammar paul@parsetec.com (Paul Mann) (2005-09-11)
Re: Parsing Expression Grammar DrDiettrich@compuserve.de (Hans-Peter Diettrich) (2005-09-14)
Re: Parsing Expression Grammar gneuner2@comcast.net (George Neuner) (2005-09-14)
Re: Parsing Expression Grammar Meyer-Eltz@t-online.de (Detlef Meyer-Eltz) (2005-09-14)
[17 later articles]
| List of all articles for this month |

From: George Neuner <gneuner2@comcast.net>
Newsgroups: comp.compilers
Date: 10 Sep 2005 12:37:50 -0400
Organization: Compilers Central
References: 05-09-009 05-09-023
Keywords: syntax, design
Posted-Date: 10 Sep 2005 12:37:50 EDT

On 7 Sep 2005 13:12:11 -0400, "Paul Mann" <paul@highpersoft.com>
wrote:


>"Chris F Clark" <cfc@shell01.TheWorld.com> wrote in message
>> But, as a potential language designer, you need to think long and hard
>> about why you want to create a language which has no LL(1) grammar.
>
>Answer: Readability for human's sake.


What's your definition of readable?.


>Why constrain your language to LL(1) when LALR(1) tools are available?


I'm just guessing but perhaps it's because LR tools produce sequence
results backwards; it's easier to position embedded actions in LL
grammars than in LR grammars; and when there is a problem, debugging
recursive decent code is easier than debugging a table driven PDA.


A better question is "why use LALR(1) when LL(k) is available"?


Chris mentioned three tools - ANTLR, PCCTS and JavaCC - all of which
use predicated LL(k) and produce recursive decent code. ANTLR creates
parsers and lexers in Java, C++, C# or Python. PCCTS creates parsers
only in C or C++. JavaCC creates parsers and lexers in Java [duh!].


Any of these tools can handle reasonable language grammars. They
handle some unreasonable ones as well - for example they all can
handle the C++ grammar.


I no longer see any reason to use LR tools unless the language is
truly bizarre or code density is *very* important because the result
will be deployed on very small machines.


George


Post a followup to this message

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