Path: utzoo!attcan!uunet!cs.dal.ca!aucs!880716a From: 880716a@aucs.uucp (Dave Astels) Newsgroups: comp.lang.c Subject: Re: lex & yacc - cupla questions Keywords: lex yacc Message-ID: <1990Jul27.185058.6257@aucs.uucp> Date: 27 Jul 90 18:50:58 GMT References: <1990Jul26.175545.959@uicbert.eecs.uic.edu> Reply-To: 880716a@aucs.UUCP (Dave Astels) Distribution: comp Organization: School of Computer Science, Acadia Univ., Nova Scotia Lines: 30 In article <1990Jul26.175545.959@uicbert.eecs.uic.edu> woodward@uicbert.eecs.uic.edu writes: >2.) how can one get the automagically-defined #defines, which can >normally be created from yacc with the -d flag, to come out when you >use a makefile? i.e. suppose i have lex.l and yacc.y lex and yacc >source files, respectively, and i have object files defined in my makefile >called lex.o and yacc.o such that "make" follows default rules to create >these from the aforementioned source files. Check your implementation of MAKE for the rule to go from .y to .o there should be a macro YACCFLAGS or such. Add a '-d' to that (in the default file or maybe your makefile. >3.) if i have a yacc construct such as: > >line3 : A B C > { yacc action sequence } > >how can i now assign the values of A, B, and C into local vars of my >choice? the problem lies in the fact that each of A B and C represent >three calls to lex, and if i pass back a pointer to yytext[] from lex, >i only retain the value of the last token in the sequence, in this case C, >when i get to the action sequence in my yacc code. return a copy of yytext, not a pointer to it. -- "I liked him better before he died" - McCoy, ST V =============================================================================== Dave Astels | Internet: 880716a@AcadiaU.CA PO Box 835, Wolfville, | Bitnet: 880716a@Acadia