Semantics make a grammar ambiguous

"Bill A" <bill@megahits.com>
26 Apr 1999 02:02:55 -0400

          From comp.compilers

Related articles
Semantics make a grammar ambiguous bill@megahits.com (Bill A) (1999-04-26)
Re: Semantics make a grammar ambiguous rsherry@home.com (Robert Sherry) (1999-04-29)
Re: Semantics make a grammar ambiguous dplass@yahoo.com (1999-04-30)
Re: Semantics make a grammar ambiguous bill@megahits.com (Bill A.) (1999-04-30)
Re: Semantics make a grammar ambiguous mikov@usa.net (Tzvetan Mikov) (1999-05-03)
Re: Semantics make a grammar ambiguous rkrayhawk@aol.com (1999-05-07)
| List of all articles for this month |
From: "Bill A" <bill@megahits.com>
Newsgroups: comp.compilers
Date: 26 Apr 1999 02:02:55 -0400
Organization: Compilers Central
Keywords: C, parse, question

In the following C fragment


typedef struct { int i; } str;


void func (void)
{
str *str;
}


I'm having difficulty parsing this with an LALR parser (generated from
a parser generator) because the second str should be an id but matches
a typedef definition so a typedef terminal is returned from the lexer.
What is the traditional way to handle this ambiguity? Is this a good
case of why most production compilers are recursive decent?


Thanks!
Bill


Post a followup to this message

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