Re: Context sensitive scanner ?

pjj@cs.man.ac.uk (Pete Jinks)
23 Nov 1997 19:41:46 -0500

          From comp.compilers

Related articles
Context sensitive scanner ? hat@se-46.wpa.wtb.tue.nl (Albert Theo Hofkamp) (1997-11-20)
Re: Context sensitive scanner ? johnm@non.net (1997-11-23)
Re: Context sensitive scanner ? pjj@cs.man.ac.uk (1997-11-23)
Re: Context sensitive scanner ? Mikael.Pettersson@sophia.inria.fr (Mikael Pettersson) (1997-11-23)
Re: Context sensitive scanner ? genew@vip.net (1997-11-23)
Re: Context sensitive scanner ? thetick@magelang.com (Scott Stanchfield) (1997-11-24)
Re: Context sensitive scanner ? cfc@world.std.com (Chris F Clark) (1997-11-28)
Re: Context sensitive scanner ? henry@zoo.toronto.edu (Henry Spencer) (1997-11-28)
Re: Context sensitive scanner ? ok@cs.rmit.edu.au (1997-11-29)
[7 later articles]
| List of all articles for this month |
From: pjj@cs.man.ac.uk (Pete Jinks)
Newsgroups: comp.compilers
Date: 23 Nov 1997 19:41:46 -0500
Organization: Dept of Computer Science, University of Manchester, U.K.
References: 97-11-117
Keywords: lex

Albert Theo Hofkamp <a.hofkamp@wtb.tue.nl> wrote:
>1) Literal reals (such as 1.2),
>2) Nested index operations on arrays (such as x.1.2).


If you recognise 1.2+x.1.2 (if that makes sense) as the tokens:
1.2
+
x
.1
.2
then you can easily write the regular expressions.


The problem is, can you do this in every case e.g. can users write
something like x.i+1.2+j meaning x.(i+1).(2+j)
or come to that, can they write x . 1 . 2
or x .
      1.2
or x . /*a big multi-line comment*/ 1.2


If you can use this trick, it might make sense to insist that your
users write code formatted like:
1.2
x .1 .2
x .i+1 .2+j


How do you deal with x.y.1.2
meaning x .(y .1) .2
not x (.y) (.1) (.2)
nor x .(y .1 .2)


As our moderator wrote, overloading notation like this is a very bad
idea if you want humans and compilers to be able to read your programs.
--
COMPUTER 50 - Manchester Celebrates the Birth of the Computer
Digital Summer 1998 http://www.cs.man.ac.uk/mark1/
--


Post a followup to this message

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