Too many states for YACC

Root Boy Jim rbj at dsys.icst.nbs.gov
Wed May 17 02:28:36 AEST 1989


? From: "Robert L. Blackburn" <rlb7h at uvaee.ee.virginia.edu>

? I am trying to write a YACC specification for a VHDL parser.  When attempting
? to generate the .c file with yacc I get the following message:

? 	fatal error: too many states, line 1198

? (line 1198 is the end of the input file).
? The abbrevieated y.output file contains the line:

? 	557/600 grammar rule, 749/750 states

? My question: is there any way to raise the limit on the number of states YACC
? will allow?  Failing that, are there some general techniques I can use in my
? specification (or things to avoid in my specification) to reduce the number of
? states YACC tries to produce?

? Better yet (hoping against hope), does anyone already have a grammer for
? VHDL that they would care to give me the [YACC] sources for?

? Thanks in advance.

Now I haven't done much haccing with yack, but I remember seeing something
about recompiling with some parameter set higher. Not much help if you
don't have source. Perhaps you should get GNU's BISON, a P.D. YACC.

There is one more thing that might help you. The obvious thing to do
is recognize each keyword in a separate rule. However, this creates
parsers that run slower. Better is to have the `identifier' recognizer
look for keywords. Actually, I think I am talking bout LEX here, but
the point still is valid. Unfortunately, that technique won't help you
for YACC. Oh well...

Another technique is to tweak your grammar to recognize a superset of
legal constructions and add other code to disallow them. For example,
a YACC specification for C might recognize "double int x", as well
as "long int x", and the error might be caught later. If this is a
stupid example, sorry, I can't think of a better one.

? -Robert Blackburn

	Root Boy Jim is what I am
	Are you what you are or what?



More information about the Comp.unix.questions mailing list