|Holub grammar problem? email@example.com (Steven Gollery) (1994-09-30)|
|Re: Holub grammar problem? firstname.lastname@example.org (1994-10-03)|
|From:||Steven Gollery <email@example.com>|
|Keywords:||books, parse, question|
|Date:||Fri, 30 Sep 1994 18:18:08 GMT|
I've looked at the list of errata for Holub's Compiler Design in C, and
I don't see any mention of a problem I've run into with it. It's
probably just something I don't understand about the grammar -- if so
I would appreciate it if someone would explain it to me.
I don't see how the grammar can handle local variables with types that
have been previously defined as typedefs. Holub's lexer returns TTYPE
when it finds a name that has been typedef'd. Local variable declarations
use these productions:
local_defs : def_list ;
def_list : def_list def
| /* epsilon */
def : specifiers decl_list SEMI
| specifiers SEMI
specifiers : type_or_class
| specifiers type_or_class
type_or_class : type_specifier
type_specifer : TYPE
Since enum_specifier has to start with the ENUM token, and
struct_specifier has to start with STRUCT, I don't see how a def can
possibly involve a TTYPE.
Hopefully someone can set me straight me straight on this. Or -- if it is
actually a problem with the grammar -- can suggest a fix: everything I've
though of so far results in about 8 conflicts of one sort or the other.
Any help appreciated.
Return to the
Search the comp.compilers archives again.