smith-josh@CS.YALE.EDU (Josh Smith) (08/04/89)
Sender: Josh Smith Reply-To: smith-josh@CS.YALE.EDU (Josh Smith) Organization: Yale University Computer Science Dept, New Haven CT 06520-2158 Keywords: Is it possible to write a LEX & YACC parser using C++ ? That is, will YACC allow action code (the commands to be executed when it detects a rule) to be written in C++? Please reply by Email to smith-josh@cs.yale.edu
mark@intek01.UUCP (Mark McWiggins) (08/05/89)
smith-josh@CS.YALE.EDU (Josh Smith) writes: >Is it possible to write a LEX & YACC parser using C++ ? >That is, will YACC allow action code (the commands to be >executed when it detects a rule) to be written in C++? Yes and yes. Here are the default makefile rules I use: .y.o: yacc $(YFLAGS) $< mv y.tab.c $*.C CC $(CCFLAGS) -c $*.C .l.o: lex $(LFLAGS) $< sed -f sed.script lex.yy.c >$*.C CC $(CCFLAGS) -c $*.C And sed.script, to keep <stream.h> 'input' and 'output' from conflicting with the ones you get in lex output: s/input/inputx/ s/output/outputx/ s/set_inputx/set_input/ Hope this helped. -- Mark McWiggins Integration Technologies, Inc. (Intek) +1 206 455 9935 DISCLAIMER: I could be wrong ... 1400 112th Ave SE #202 Bellevue WA 98004 uunet!intek01!mark Ask me about C++!