Re: lex/flex incompatabilities (Barton Christopher Massey)
Sun, 6 Oct 1991 22:46:05 GMT

          From comp.compilers

Related articles
lex/flex incompatabilities (1991-10-04)
Re: lex/flex incompatabilities cadreor! (1991-10-05)
Re: lex/flex incompatabilities (1991-10-06)
Re: lex/flex incompatabilities (1991-10-07)
Re: lex/flex incompatabilities (1991-10-07)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (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 Van Dyke) writes:
> (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

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

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...

Post a followup to this message

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