Re: what scanner scheme is efficient?

adrian@dcs.rhbnc.ac.uk (A Johnstone)
19 Nov 1996 23:31:53 -0500

          From comp.compilers

Related articles
[5 earlier articles]
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)
Re: what scanner scheme is efficient? jlilley@empathy.com (1996-10-30)
Re: what scanner scheme is efficient? vern@daffy.ee.lbl.gov (1996-11-12)
Re: what scanner scheme is efficient? jlilley@empathy.com (1996-11-15)
Re: what scanner scheme is efficient? adrian@dcs.rhbnc.ac.uk (1996-11-19)
Re: what scanner scheme is efficient? vern@daffy.ee.lbl.gov (1996-11-21)
Re: what scanner scheme is efficient? adrian@dcs.rhbnc.ac.uk (1996-11-24)
Re: what scanner scheme is efficient? jlilley@empathy.com (1996-12-01)
| List of all articles for this month |

From: adrian@dcs.rhbnc.ac.uk (A Johnstone)
Newsgroups: comp.compilers
Date: 19 Nov 1996 23:31:53 -0500
Organization: Royal Holloway, University of London
References: 96-10-076 96-10-081 96-10-149 96-11-079 96-11-103
Keywords: lex

John Lilley (jlilley@empathy.com) wrote:


: What sample have you examined to arrive at the conslusion that *most*
: scanners require backing-up? The languages that I know of (C, C++,
: Pascal) do not require any backtracking to support their keyword sets.


But it's not just keywords. Consider the two Pascal fragments:


                                      1.4


                                      1..4


The first tokenises as REAL_LITERAL(1.4) whereas the second goes to
INTEGER_LITERAL(1) KEYWORD(..) INTEGER_LITERAL(4). After lexing 1. if
you then see another period you have to back up.


                                                                Adrian (who's been burnt - see RDP 1.3)


--
    Dr Adrian Johnstone, Dean of the Science Faculty, Dept of Computer Science,
        Royal Holloway, University of London, Egham, Surrey, TW20 0EX, England.
Email: adrian@dcs.rhbnc.ac.uk Tel: +44 (0)1784 443425 Fax: +44 (0)1784 443420
--


Post a followup to this message

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