home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!mips!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!news.u.washington.edu!serval!phys1.physics.wsu.edu!hlu
- From: hlu@phys1.physics.wsu.edu (Hongjiu Lu)
- Newsgroups: comp.os.linux
- Subject: Re: yacc and lex
- Message-ID: <1992Jul22.210710.8123@serval.net.wsu.edu>
- Date: 22 Jul 92 21:07:10 GMT
- References: <1992Jul21.164738.1@mcclb0.med.nyu.edu> <WEILER.92Jul21213719@crabapple.cis.ohio-state.edu> <1992Jul22.135605.12853@advtech.uswest.com>
- Sender: news@serval.net.wsu.edu (USENET News System)
- Organization: Washington State University
- Lines: 47
-
- In article <1992Jul22.135605.12853@advtech.uswest.com>, mcain@copper (Michael Cain) writes:
- |> In article <WEILER.92Jul21213719@crabapple.cis.ohio-state.edu> weiler@crabapple.cis.ohio-state.edu (Jerry Weiler) writes:
- |> >In article <1992Jul21.164738.1@mcclb0.med.nyu.edu> ramirez@mcclb0.med.nyu.edu writes:
- |> >
- |> >> I would like to know if anybody has ported yacc and lex
- |> >> over to linux. If yes, please let me know where I can find it.
- |> >
- |> >You should use bison and flex. bison is the GNU replacement for yacc
- |> >and flex is the GNU replacement for lex. They're faster, more flexible
- |> >and all around better. Bison and flex should be able to handle any
- |> >grammer yacc and lex do (any well written one, that is)
- |>
- |> Flex does have one significant handicap when compared to lex: in lex,
- |> the default i/o functions are actually macros, which can be #undef'ed
- |> and replaced with real functions of the same name that can get input
- |> from anywhere; flex has real functions that insist on reading from
- |> files, and trying to replace these is semi-major surgery...
- |>
-
- Did the FSF just release a new flex? I used flex 2.3.7. I did this
- ---------
- #undef ECHO
- #define ECHO cout.put ((char *) yytext, yyleng)
-
- #undef YY_INPUT(buf,result,max_size)
- #define YY_INPUT(buf,result,max_size) \
- {char c; cin.get (c); result = (cin.eof ()) ? YY_NULL : (buf[0] = c, 1);}
- ---------
-
- As you can see, that was for C++. But the story is the same. I haven't found
- what I couln't do with flex. Sometimes, you just have to read those docs.
- BTW, I ran it with flex -I for interactive use.
-
-
- |> I regularly seem to want to parse stuff and don't want to let the
- |> analyzer built by flex handle my low-level file i/o...
- |>
-
- I think you can do that with flex 2.3.7. Check those docs.
-
- |> Mike Cain
- |> U S WEST Advanced Technologies
- |> mcain@advtech.uswest.com
-
- --
- H.J.
- Gcc/libc maintainer for Linux.
-