Re: LR(1) Parser Generator

Tim Josling <tej@melbpc.org.au>
6 Aug 2001 04:02:52 -0400

          From comp.compilers

Related articles
[4 earlier articles]
Re: LR(1) Parser Generator tej@melbpc.org.au (Tim Josling) (2001-07-23)
Re: LR(1) Parser Generator haberg@matematik.su.se (2001-07-23)
Re: LR(1) Parser Generator david@tribble.com (David R Tribble) (2001-07-23)
Re: LR(1) Parser Generator cotemark@globetrotter.net (Mark) (2001-07-23)
Re: LR(1) Parser Generator thp@cs.ucr.edu (2001-07-30)
Re: LR(1) Parser Generator soenke.kannapinn@wincor-nixdorf.com (Sönke Kannapinn) (2001-08-02)
Re: LR(1) Parser Generator tej@melbpc.org.au (Tim Josling) (2001-08-06)
LR(1) Parser Generator pjain@iitk.ac.in (2003-04-05)
| List of all articles for this month |

From: Tim Josling <tej@melbpc.org.au>
Newsgroups: comp.compilers
Date: 6 Aug 2001 04:02:52 -0400
Organization: Melbourne PC User Group
References: 01-07-060 01-07-102 01-07-115 01-07-161
Keywords: parse, LR(1)
Posted-Date: 06 Aug 2001 04:02:52 EDT

I have installed MSTA parser generator. It works fine with no bugs
found to date, with the exception that it does not have an implicit $$
= $1 rule, so I had to go through the grammar and hand code them
all. I can now try turning LR on and simplifying my grammar.


MSTA also has some good constructs for opional elements, repeated
elements. In my current grammar I have a lot of things lie this


X+opt:
/* Nothing. */
|X {
      $$ = $1;
};


and this:


X_rep:
X { $$ = $1;}
|X_rep X { ... };


He even has a construct for comma-separated lists.


So I should be able to reduce the size of the source code of the grammar
by 35% or so.


I am seeing about a 3% slow down in both build time and time to run my
test suite vs using bison.


I will report back how I go.


Tim Josling


thp@cs.ucr.edu wrote:


> Tim Josling <tej@melbpc.org.au> wrote:
> : Mike,
>
>
> Have you tried to resolve these conflicts by hand by giving priorities
> to the rules?


No. Given the huge size of the COBOL grammar, working out how the problem
arises, and what the two rules are that conflict is the main problem. It
is very difficult to be sure that hand coding priorities will have the
desired effect,


As an example of the size of the COBOL grammar, Tiny COBOL just blew the
32k limit for table size.


>
>
> : I am pretty confident the conflicts are spurious, and that LR(1)
> : will fix the problem.
>
> Are you sure that your grammar isn't ambiguous?


Yes I am.


Post a followup to this message

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