Re: List Parsing in LALR

news@sleitch.nildram.co.uk
14 Oct 1999 01:24:08 -0400

          From comp.compilers

Related articles
List Parsing in LALR pplouis@my-deja.com (1999-09-06)
Re: List Parsing in LALR news@sleitch.nildram.co.uk (1999-10-14)
| List of all articles for this month |

From: news@sleitch.nildram.co.uk
Newsgroups: comp.compilers
Date: 14 Oct 1999 01:24:08 -0400
Organization: Phoenix Engineering
References: 99-09-018
Keywords: parse, comment

pplouis@my-deja.com wrote:
> How to write grammar for lists like this in LALR(1)?


> aList -> anItem ;
> aList -> aList anItem ;


> anItem -> 'boo' 'foo' ;
> anItem -> 'bar' 'boo' ;
> anItem -> 'bar' ;




> Thanks for the help.
> PP Louis
> [Expand and flatten it, I suppose, or else use a lexical hack to peek ahead
> two tokens. -John]


You could try affix grammars of which the van Wijngaarden grammar is
one example. See the specification of Algol 68.
--
Sian Leitch (Software Engineer specialising in Algol 68)
[So how do you parse an affix grammar using an LALR(1) parser? -John]


Post a followup to this message

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