Re: Questions about Yacc (YYMAXDEPTH)

dg@hplabs.hpl.hp.com (Dipankar Gupta)
7 Mar 91 11:14:02 GMT

          From comp.compilers

Related articles
Questions about Yacc (YYMAXDEPTH) srini@synopsys.Synopsys.COM (1991-03-05)
Re: Questions about Yacc (YYMAXDEPTH) dg@hplabs.hpl.hp.com (1991-03-07)
Re: Questions about Yacc (YYMAXDEPTH) bliss@sp64.csrd.uiuc.edu (1991-03-08)
Re: Questions about Yacc (YYMAXDEPTH) kathy@hpdcdb.fc.hp.com (Kathy Harris) (1991-03-13)
| List of all articles for this month |
Newsgroups: comp.compilers
From: dg@hplabs.hpl.hp.com (Dipankar Gupta)
Keywords: yacc
Organization: Hewlett-Packard Laboratories, Bristol, England
References: <694@synopsys.COM>
Date: 7 Mar 91 11:14:02 GMT

In article <694@synopsys.COM> srini@synopsys.Synopsys.COM (Srinivas Raghvendra) writes:
>This is a question about the standard Yacc tool distributed with Unix.
>
>I notice that Yacc uses a #define named YYMAXDEPTH and that this value has
>been set at 150.
> (1) I notice that even for moderately nested constructs, this seems
> insufficient. (I get a Yacc stack overflow). Has anybody else faced
> the same problem ?
> (2) If the answer to (1) is Yes, what is a reasonable value for
> YYMAXDEPTH ?


You may want to use the __RUNTIME_YYMAXDEPTH option, which allows runtime
allocation of YACC stacks. You may choose a convenient value for
the increment YYINCREMENT. This uses malloc (3) routines to manage stacks.


Caveat:
The version of yacc that I have (on HP-UX 7.0) demands char *malloc (), which
may interfere with ANSI headers.


Dipankar Gupta
Hewlett-Packard India Software Operation, Bangalore, India
dg@hplb.hpl.hp.com
[This must be an HP-ism, it's not present in the SVR3 yacc parser. Personally,
I've always found the default depth to be plenty. What sort of grammars are
you parsing that overflow? -John]
--


Post a followup to this message

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