Re: lex rules

Esmond Pitt <esmond.pitt@bigpond.com>
1 Dec 2000 13:36:36 -0500

          From comp.compilers

Related articles
lex rules brian@NOSPAMibc.com.au (Blake Stone) (2000-11-30)
Re: lex rules fjh@cs.mu.OZ.AU (2000-12-01)
Re: lex rules esmond.pitt@bigpond.com (Esmond Pitt) (2000-12-01)
| List of all articles for this month |
From: Esmond Pitt <esmond.pitt@bigpond.com>
Newsgroups: comp.compilers
Date: 1 Dec 2000 13:36:36 -0500
Organization: Melbourne Software Company Pty Ltd
References: 00-11-176
Keywords: lex
Posted-Date: 01 Dec 2000 13:36:36 EST

Are you using lex or flex?


lex has a bug that things inside {} are not treated as single units.


e.g. your {EncName} is not treated as ([A-Za-z][A-Za-z0-9._]*) but as
[A-Za-z][A-Za-z0-9._]*.


This gets tricky if you have constructions like {name}? &c, the ? only
applies to the last part of the thing expanded, not the whole.


This was fixed in flex at my request in about 1991. You should use flex
anyway, it's miles better. If you can't, and if this is your problem,
change all your name definitions to be inside brackets, e.g.


ws ([ \t\r\n]+)


Esmond Pitt
[This turned out indeed to be the problem - private communication with
original poster - EJP.]


Post a followup to this message

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