[comp.unix.questions] yacc

cavanaug@ncrcce.StPaul.NCR.COM (John David Cavanaugh) (11/18/88)

I am working on a C compiler that has a couple of yacc-generated
parsers (one for the C input, one for the intermediate language).
I recently made a change to one of the yacc grammar definitions (the
.y file), and when I run yacc, I get a message saying, "fatal error:
too many states."  When I run yacc with -v on a slightly simplified
.y file, it tells me that it is defining 748 of 750 states.

My question is:  is there any way I can increase the number of states?
If so, how do I do it?  The documentation I've been able to get my
hands on says nothing about the number of states.

Thanks in advance for any help or hints.

-- 
John Cavanaugh                       John.Cavanaugh@StPaul.NCR.COM
NCR Comten, Inc.                     (612) 638-2822
2700 Snelling Ave. N
St. Paul, MN  55113                  Standard disclaimer.

mike@hpfcdc.HP.COM (Mike McNelly) (11/19/88)

> I am working on a C compiler that has a couple of yacc-generated
> parsers (one for the C input, one for the intermediate language).
> I recently made a change to one of the yacc grammar definitions (the
> .y file), and when I run yacc, I get a message saying, "fatal error:
> too many states."  When I run yacc with -v on a slightly simplified
> .y file, it tells me that it is defining 748 of 750 states.
> 
> My question is:  is there any way I can increase the number of states?
> If so, how do I do it?  The documentation I've been able to get my
> hands on says nothing about the number of states.

Unless you have access to the source code for yacc, the state limit is a
hard one.  Yacc does not have dymanically allocated arays for its
internal use so the only way to increase the number of allowable states
is to modify the source code and recompile.  That's a trivial process if
you have the source code.

The source can also be modified to make the internal arrays extensible.
Our customers kept running into the same problems so we made the mods.
Sorry, I can't release source code.

Mike McNelly	mike%hpfcla@hplabs.hp.com

thomas@uplog.se (Thomas Hameenaho) (11/21/88)

In article <895@ncrcce.StPaul.NCR.COM> John.Cavanaugh@StPaul.NCR.COM (John David Cavanaugh) writes:
>I recently made a change to one of the yacc grammar definitions (the
>.y file), and when I run yacc, I get a message saying, "fatal error:
>too many states."  When I run yacc with -v on a slightly simplified
>.y file, it tells me that it is defining 748 of 750 states.
>
>My question is:  is there any way I can increase the number of states?

Not without recompiling yacc.



-- 
Real life:	Thomas Hameenaho		Email:	thomas@uplog.{se,uucp}
Snail mail:	TeleLOGIC Uppsala AB		Phone:	+46 18 189406
		Box 1218			Fax:	+46 18 132039
		S - 751 42 Uppsala, Sweden

mah@hpuviea.UUCP (Michael Haberler) (11/23/88)

From article <5740033@hpfcdc.HP.COM>, by mike@hpfcdc.HP.COM (Mike McNelly):
>> too many states."  When I run yacc with -v on a slightly simplified
>> .y file, it tells me that it is defining 748 of 750 states.
>> 
>> My question is:  is there any way I can increase the number of states?
>> If so, how do I do it?  The documentation I've been able to get my
>> hands on says nothing about the number of states.
> 
> Unless you have access to the source code for yacc, the state limit is a
> hard one.  Yacc does not have dymanically allocated arays for its

Why not just forget about Yacc and use Bison, a Free Software Foundation
replacement for Yacc? Browse through your next comp.sources.unix archive
and you might be able to find it. I got it to work on a PC; it does the
complete Ada grammar in under 2 minutes on an AT. And this one sure has
a substantial number of states.

-michael
-- 
Michael Haberler		mah@hpuviea.at 
Hewlett-Packard Austria GmbH, 	...mcvax!tuvie!hpuviea!mah
Lieblgasse 1 			...hplabs!hpfcla!hpbbn!hpuviea!mah
A-1220 Vienna, Austria		Tel: (0043) (222) 2500 x412 (9-18 CET) 	

alk@ux.acss.umn.edu (11/24/88)

Need to modify yacc, but can't get source code?  Use BISON!!!
Bison comes *free* with most gcc distributions, and is also on simtel20,
and prep.ai.  

--alk, gnu-wave thinker extraordinaire.

domo@riddle.UUCP (Dominic Dunlop) (11/24/88)

In article <340@uplog.se> thomas@uplog.UUCP (Thomas Hameenaho) writes:
>In article <895@ncrcce.StPaul.NCR.COM> John.Cavanaugh@StPaul.NCR.COM
>>	(John David Cavanaugh) writes:
>>... when I run yacc, I get a message saying, "fatal error:
>>too many states."
>>
>>My question is:  is there any way I can increase the number of states?
>
>Not without recompiling yacc. [to increase table sizes]

I have this strong recollection that, at the recent London System V,
release 4 developers' conference, I heard that, at last, yacc's tables were
to be made dynamic, an announcement greeted with a buzz of approval from
the audience.  But I can't find any statement to that effect in the
distributed documentation or in the notes I took.  Had I dozed off?  Was I
dreaming?  Can anybody confirm or deny this story?

(Not that it helps John much.  He needs a fix now, not in a year.)
-- 
Dominic Dunlop
domo@sphinx.co.uk  domo@riddle.uucp

spl@mcnc.org (Steve Lamont) (06/01/89)

Gentlefolk:

  I'm attempting to learn yacc(1) and lex(1).  I've read Johnson's
writeup on Yacc and Lesk and Schmidt on Lex in the USENIX "UNIX
Programmer's Supplementary Documents, Volume 1" but I'd like to find
something to supplement those writeups.  Can anyone give me any pointers
to other books or publications.

  Please reply by EMAIL rather than clutter the net.  If there is
sufficient interest, of course, I'll summarize.
-- 
							spl
Steve Lamont, sciViGuy			EMail:	spl@ncsc.org
North Carolina Supercomputing Center	Phone: (919) 248-1120
Box 12732/RTP, NC 27709

mef@romulus.rutgers.edu (Marc E. Fiuczynski) (04/05/91)

This is a desperate move.  I need a good example of a yacc grammar.
If you have that you would like to share with me please send it to 
me via e-mail.  I'm trying to use yacc learning/reading the sun manual
and I'm not getting anywhere.  Please, if you can send me a yacc grammar
that you wrote I would really appreciate it.  

The reason for this urgency is that I am working on an (independent)
project for school and I am getting stuck on using yacc.

Thanks in advance!
-Marc
-- 
______________________________________________________________________________
Marc E. Fiuczynski	\\  Home: (609) 683-4416	School: (908) 878-9388
mef@remus.rutgers.edu  	//  UUCP: {backbone}!rutgers!remus.rutgers.edu!mef