Re: what scanner scheme is efficient?

peter@bj-ig.de (Peter Brueckner)
15 Oct 1996 09:35:38 -0400

          From comp.compilers

Related articles
what scanner scheme is efficient? lloix@star.spb.ru (1996-10-12)
Re: what scanner scheme is efficient? peter@bj-ig.de (1996-10-15)
Re: what scanner scheme is efficient? ramb@primenet.com (Ram Bhamidipaty) (1996-10-16)
Re: what scanner scheme is efficient? peter@peter.bj-ig.de (Peter Brueckner) (1996-10-18)
Re: what scanner scheme is efficient? roth@noel.cs.rice.edu (1996-10-20)
Re: what scanner scheme is efficient? jsgray@acm.org (Jan Gray) (1996-10-20)
Re: what scanner scheme is efficient? clark@quarry.zk3.dec.com (1996-10-24)
Re: what scanner scheme is efficient? james@wgold.demon.co.uk (James Mansion) (1996-10-24)
[7 later articles]
| List of all articles for this month |
From: peter@bj-ig.de (Peter Brueckner)
Newsgroups: comp.compilers
Date: 15 Oct 1996 09:35:38 -0400
Organization: =?iso-8859-1?Q?Br=FCckner?= & Jarosch Ingenieurgesellschaft mbH
References: 96-10-041
Keywords: lex

lloix@star.spb.ru <lloix@star.spb.ru> wrote:
>Thus the question is simple, how do professionals design their scanners
>and tables, what do they do with keywords, and what is the more effective
>approach?


The best approch is to have an rule for 'IDENT' in the lexical
scanner and an stage IDENT->RESERVED_WORD after the call to the
scanner. This has a few advantages:


  1. You can modify the resword-table (example: ansi in C-grammar )


  2. You can have context-sensitive resword-scope. (example the Grammar
        says what words are useful (like 'type-name','undefined ident' in pascal)


The resword table is an simple hash (O(1) like the scanner - so
you have O(1) + O(1) = O(1)) and can have hash-keys with or without
case-sensitivity.


--
Peter Brueckner, Brueckner&Jarosch Ing.-GmbH Erfurt, Germany 99084 Erfurt
Andreasstr. 37, TEL +49=361-64318.11, FAX .12, EMail peter@bj-ig.de,-42-


--


Post a followup to this message

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