delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/12/13:06:52

Date: Mon, 12 May 1997 13:06:24 -0400 (EDT)
From: "Art S. Kagel" <kagel AT ns1 DOT bloomberg DOT com>
To: Gary R Sekinger <sekinger+@andrew.cmu.edu>
Cc: djgpp AT delorie DOT com
Subject: Re: flex/bison lower/upper case question
In-Reply-To: <onQwIAK00iWQADCEpw@andrew.cmu.edu>
Message-Id: <Pine.D-G.3.91.970512130208.24572B-100000@dg1>
Mime-Version: 1.0

On Fri, 9 May 1997, Gary R Sekinger wrote:

> 
> 
> I'd like to have my grammar be case insensitive but this doesn't seem
> very easy. I've started specifying all the various combinations, which
> isn't very practical:
> 
> SEED    {return SEED;}
> Seed    {return SEED;}
> seed    {return SEED;}
> 
> Is there an easy way to do this? I have the Lex & Yacc book by O'Reilly
> but would love to look at other example grammars. Any suggestions of
> grammars out there in the public domain?
> 
> tia,
> Gary Sekinger
> 
> ps. Im using:
> 
> E:\WINDOWS>flex --version
> c:/djgpp/bin/flex.exe version 2.5.2
> 
> E:\WINDOWS>bison --version
> GNU Bison version 1.24
> 
> 

From the GNU Flex manual Chapter 5.1:

...There are ways for specifying case-insensitive scanners in LEX, but they
are generally ugly and difficult to understand. ....


From the GNU Flex manual Chapter 5.1.1:

   Flex has a very simple way of solving this problem.  By using the '-i'
switch on the command line, you can tell Flex to generate a scanner that
ignores case in its input. ...

So just add -i to the Flex command line when generating the parser and voila!

Art S. Kagel, kagel AT bloomberg DOT com

- Raw text -


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