yacc sorrows

Andrew P. Mullhaupt amull at Morgan.COM
Fri Feb 16 08:10:27 AEST 1990


In article <22529 at mimsy.umd.edu>, chris at mimsy.umd.edu (Chris Torek) writes:
> In article <1990Feb9.171557.18465 at tcsc3b2.tcsc.com> prs at tcsc3b2.tcsc.com
> (Paul Stath) writes:
> >The string that gets matched in LEX is stored in a character pointer called
> >`yytext'.
> 
> Actually, this is an array (of size YYLMAX, typically 200) of characters,
> not a pointer.

Yes, if you're referring to real live 'lex'. If you have 'flex' instead,
it gets declared as a pointer to character. 

This discrepancy, typical of those between yacc and bison, is small
but annoying. Does anyone know what the reason is for this one?

Discrepancies aside, the documentation for bison is a pretty good
surrogate for yacc. Two books _The UNIX Programming Environment_
by Kernighan and Pike, and _UNIX Utilities_ by R.S. Tare provide
tutorials on yacc. 

Although you should be able to get yacc to generate the parser you
want independent of what OS you're running, there are some differences
of note. System V UNIX has text messages for debugging a yacc parser
based on the production in the grammar specification, and BSD UNIX
(and Bison) provide references to the production by number, but also
give the stack state. 

Later,
Andrew Mullhaupt



More information about the Comp.lang.c mailing list