Re: LEX and symbol table

vern@daffy.ee.lbl.gov (Vern Paxson)
Tue, 1 Nov 1994 17:06:50 GMT

          From comp.compilers

Related articles
LEX and symbol table twallace@mason1.gmu.edu (1994-10-25)
Re: LEX and symbol table vern@daffy.ee.lbl.gov (1994-11-01)
| List of all articles for this month |
Newsgroups: comp.compilers
From: vern@daffy.ee.lbl.gov (Vern Paxson)
Keywords: lex
Organization: Lawrence Berkeley Laboratory, Berkeley CA
References: 94-10-185
Date: Tue, 1 Nov 1994 17:06:50 GMT

> [It doesn't much matter whether you do your single character operators
> as separarate rules or not. I'm more inclined to do this:
>
> [+-=()*^!\[\],?/] { return yytext[0]; }


There's one minor problem with this approach, which is how easy it is to
accidentally introduce a character class range, like '+' through '=' as
happens above. John's key point remains, though: with lex, it does *not*
slow down your scanner to add rules, so from a performance perspective,
grouping the operators together like the above, or giving each their own
line, doesn't make a difference. I like the above style because it
results in less visual clutter.


Vern


Vern Paxson vern@ee.lbl.gov
Information and Computing Sciences ucbvax!ee.lbl.gov!vern
Lawrence Berkeley Laboratory (510) 486-7504
--


Post a followup to this message

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