Related articles |
---|
Beginner help with LALR(1) closure kentr@rollinssoft.com (Kent Rollins) (1996-11-12) |
Re: Beginner help with LALR(1) closure dlester@cs.man.ac.uk (1996-11-14) |
Re: Beginner help with LALR(1) closure grout@sp55.csrd.uiuc.edu (1996-11-14) |
Re: Beginner help with LALR(1) closure compres@world.std.com (1996-11-14) |
Re: Beginner help with LALR(1) closure farzu@cs.tamu.edu (Francisco Arzu) (1996-11-14) |
Re: Beginner help with LALR(1) closure adrian@dcs.rhbnc.ac.uk (1996-11-19) |
Re: Beginner help with LALR(1) closure salomon@silver.cs.umanitoba.ca (1996-11-19) |
[3 later articles] |
From: | Kent Rollins <kentr@rollinssoft.com> |
Newsgroups: | comp.compilers |
Date: | 12 Nov 1996 22:04:02 -0500 |
Organization: | Compilers Central |
Keywords: | LALR, question |
I'm working on writing my own LALR(1) parser table generator and
I'm a little stuck. I'm doing this because I want to understand
the parsing process. Any tips would be greatly appreciated.
I'm using 'Compiler Design in C' [Holub]. I'm currently working
on performing LALR(1) closure on LALR(1) states. I've got 2
questions:
1. I've downloaded a few YACC-able grammars and I've noticed that
they all have left-recusive grammars like (A) below. When I
run this thru my generator, these cause infinite recursion.
I can't find anything in Holub about how the LALR(1) generator
should handle left-recursion. In order to get around the
problem, I used a technique from a previous chapter which
eliminates left-recursion (B) from LL grammars. I would like to
know how the LALR(1) closure process avoids left recursion.
A //// statement-list statement
A //// statement-list statement
B //// statement-list statement statement-list-pri
B ////
B //// statement-list-pri statement statement-list-pri
B //// EPS
2. How are circular references like the following handled when
performing LALR(1) closure?
type_specifier void
char
short
int
long
float
double
signed
unsigned
struct_or_union_specifier
enum_specifier
type_name
specifier_qualifier_list type_specifier specifier_qualifier_list
type_specifier
type_qualifier specifier_qualifier_list
type_qualifier
type_name specifier_qualifier_list
specifier_qualifier_list abstract_declarator
Any assistance would be greatly appreciated.
Kent
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.