www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/06/14/10:19:38

Subject: Re: Flex 2.4.7
To: mail AT notis DOT com (Kevin)
Date: Wed, 14 Jun 95 8:10:12 EDT
From: bodfish <bodfish AT notis DOT com>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

Regarding this question:

> I had a compiler for a language we're developping on a Unix system.  On the
> Unix system, I use Bison and Lex.  DJGPP Bison works fine, and i got Flex to
> work except for one thing: it won't skip comments!  It's built into the grammar
> and it works on Unix.  It's the same file that I'm processing.  Anyone had
> similar problems or have any ideas?

I checked the POSIX standard for lex, and I suspect the problem is that
your Unix system's lex isn't compliant, where it seems that flex
is, on this matter. The standard says that anything in the Rule section
not begining with a blank is an ERE. (This is actually my inference from
the wording of the standard.) If it begins with a blank, and it
comes before any Rule, it will be copied to the lex.yy.c file (that's why
I think indented comments work in flex). If it begins with a blank but
comes *after* any Rule, the behavior is undefined.

Perhaps it's pertinent here that the "/" character can indicate trailing
context; was that added to lex's ERE syntax after your Unix's lex? I don't
know the history here, so that's just speculation.

John Bodfish
bodfish AT notis DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019