Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!husc6!ogccse!blake!uw-beaver!sumax!polari!happym!nwnexus!intek01!mark From: mark@intek01.UUCP (Mark McWiggins) Newsgroups: comp.lang.c++ Subject: Re: Using YACC with C++ question Message-ID: <230@intek01.UUCP> Date: 4 Aug 89 17:13:43 GMT References: <68580@yale-celray.yale.UUCP> Organization: Integration Technologies Inc. (Intek), Bellevue WA Lines: 31 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 '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++!