Re: lex and yacc for C++

vern@daffy.ee.lbl.gov (Vern Paxson)
Wed, 17 Jun 1992 16:29:21 GMT

          From comp.compilers

Related articles
lex and yacc for C++ ubacw00@ucl.ac.uk (1992-06-16)
Re: lex and yacc for C++ vern@daffy.ee.lbl.gov (1992-06-17)
Re: lex and yacc for C++ dkoosis@aristotle.sbi.com (1992-06-17)
Re: lex and yacc for C++ ipser@solomon.technet.sg (1992-06-18)
Re: lex and yacc for C++ ken@syd.dit.csiro.au (1992-06-18)
Re: lex and yacc for C++ collison@osf.org (1992-06-18)
| List of all articles for this month |
Newsgroups: comp.compilers,comp.lang.c,comp.lang.c++
From: vern@daffy.ee.lbl.gov (Vern Paxson)
Keywords: lex, yacc, C++
Organization: Lawrence Berkeley Laboratory, Berkeley
References: 92-06-064
Date: Wed, 17 Jun 1992 16:29:21 GMT

ubacw00@ucl.ac.uk (Mick Farmer) writes:
> Some people said that
> GNU's flex and bison could handle C++, but I'm unable to verify this.
>
> [The distributed versions of flex and bison handle only C ... -John]


flex can be used to generate scanners with C++ actions without any extra
work. My makefiles basically look like:


scan.o: scan.l
flex $(LFLAGS) -t scan.l >scan.cc
$(CPLUS) $(CFLAGS) -c scan.cc


where CPLUS is one of g++, cfront, or Centerline C++. I use the stock
(SunOS) yacc in the same way, with the minor tweak of using sed to remove
conflicting definitions of malloc() & friends from the generated parser.


Vern


Vern Paxson vern@ee.lbl.gov
Computer Systems Engineering ucbvax!ee.lbl.gov!vern
Lawrence Berkeley Laboratory (510) 486-7504
[Oh, right, sorry. Flex scanners do indeed compile fine under C++. They
don't do anything OOPish, though. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.