Are yacc parsers portable ?

Naim Abdullah naim at eecs.nwu.edu
Sat Jul 30 11:41:48 AEST 1988


[I am a sporadic reader of this newsgroup, so please forgive me if this
 question has been beaten to death here].
 
Is the C parser produced by yacc, portable ? I was looking at it and it had
stuff like:

yyparse() {

	short yys[YYMAXDEPTH];

	register short yystate, *yyps, yyn;
        ...
	yyps= &yys[-1];
	...
}

It seems to me that negative indices on arrays are probably not portable.
Is it really necessary for yacc to do these tricks, or can it produce
portable code that is just as efficient ? Is bison any better in this respect ?

Thank you.

		      Naim Abdullah
		      Dept. of EECS,
		      Northwestern University

		      Internet: naim at eecs.nwu.edu
		      Uucp: {oddjob, chinet, att}!nucsrl!naim



More information about the Comp.lang.c mailing list