Related articles |
---|
lex/flex incompatabilities jk@cs.man.ac.uk (1991-10-04) |
Re: lex/flex incompatabilities cadreor!neil@uunet.uu.net (1991-10-05) |
Re: lex/flex incompatabilities bart@cs.uoregon.edu (1991-10-06) |
Re: lex/flex incompatabilities Tony_Mason@transarc.com (1991-10-07) |
Re: lex/flex incompatabilities vern@daffy.ee.lbl.gov (1991-10-07) |
Newsgroups: | comp.compilers |
From: | bart@cs.uoregon.edu (Barton Christopher Massey) |
Keywords: | lex, flex |
Organization: | Department of Computer Science, University of Oregon |
References: | 91-10-014 91-10-019 |
Date: | Sun, 6 Oct 1991 22:46:05 GMT |
In article 91-10-019 cadreor!neil@uunet.uu.net (Neil Van Dyke) writes:
> jk@cs.man.ac.uk (John Kewley ICL) writes:
> >Apart from yywrap (needs undefing if defined) what other problems might I
> >have with flex/lex compatibility.
...
> - Flex groups expansions by placing parenthesis, so
> NAME [A-Z][A-Z0-9]*
> %%
> foo{NAME}? printf("Matched.\n");
> will match "foo" in Flex, but not in Lex.
On the other hand, probably the single biggest compatibility
mistake for me is that
- Flex doesn't understand the beginning-of-line operator "^"
or end-of-line operator "$" inside parens -- including the
implicit parens resulting from expansion -- so
LABEL ^[A-Z][A-Z0-9]*
COMMENT ";".*$
%%
{LABEL} printf("Matched.\n");
{COMMENT} printf("Comment.\n");
will match the lines "FOO" or "; comment" in LEX but not in
FLEX.
I must admit that I do this almost every time I write a FLEX
scanner, and then spend an hour or so trying to figure out what
the heck happened.
FLEX is still about a 1000% improvement over LEX. Thanks much
to Vern and the rest for their great work!
Bart Massey
bart@cs.uoregon.edu
P.S. -- When do we get released FLEX bits that build C code
instead of tables for the automata? I've been eagerly awaiting
this one...
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.