yacc with multiple attributes
Joe Baker
jbaker at ee.ucla.edu
Thu Jun 30 14:49:39 AEST 1988
[ This isn't really a C question, but all the yacc users seem to be
here. Sorry for the interruption from the C/FORTRAN debate. ]
I am working on an interpreter for a little language with C-like
syntax. Since I have several data types, and will probably be adding
type constructors at some point, I'd like to set up a fairly general
type system. Because of this, lots of the non-terminals will have
several attributes. I can see a couple of possible approaches:
1) Build an explicit parse tree, use the yacc value stack to hold
the node pointers, and carry the type information in the nodes.
2) Use a struct on the value stack, and carry both value and type
information (i.e., copy the stuff in Aho, Sethi, and Ullman, chap. 6.)
I think this would work with various intermediate code representations,
but I'm leaning to an explicit parse tree to simplify error recovery.
3) ?
Any opinions or pointers to examples?
Thanks in advance. Please send mail to me and I will summarize to the
net if there is any interest.
- Joe Baker, Dept. of Electrical Engineering
6731 Boelter Hall, UCLA, L.A., CA 90024 (213) 825-7079, 825-2327
ARPA: jbaker at ee.ucla.edu UUCP: {ihnp4|randvax|ucbvax}!ucla-cs!uclaee!jbaker
More information about the Comp.lang.c
mailing list