Who should convert literals to integers?

Dale Worley <think!compass!worley@eddie.mit.edu.uucp>
Wed, 17 Aug 88 10:27:45 EDT

          From comp.compilers

Related articles
Who should convert literals to integers? ubc-cs!calgary!radford@uunet.com (1988-08-12)
Who should convert literals to integers? think!compass!worley@eddie.mit.edu.uucp (Dale Worley) (1988-08-17)
Re: Who should convert literals to integers? haddock!ico!rcd (1988-08-17)
Re: Who should convert literals to integers? Tom.Lane@ZOG.CS.CMU.EDU (1988-08-21)
Re: Who should convert literals to integers? markhall@pyramid.pyramid.com (1988-08-29)
Re: Who should convert literals to integers? tgl@zog.cs.cmu.edu (1988-09-04)
Re: Who should convert literals to integers? wendyt@pyrps5.pyramid.com (1988-09-09)
| List of all articles for this month |
Date: Wed, 17 Aug 88 10:27:45 EDT
From: Dale Worley <think!compass!worley@eddie.mit.edu.uucp>

      From: ubc-cs!calgary!radford@uunet.com (Radford Neal)
      Subject: Who should convert literals to integers?


      Does anyone else think that converting a series of digits into an integer
      is inappropriate for a lexical analyser? It seems to be a very common
      thing to do, but I can see practically no advantages to it, and several
      disadvantages.


I think that the custom got started when compilers were written in
assembler and had to run in very little memory (less than 100K!). In
that case, intermediate representations are optimized to be dense and
fixed-field. Both of these goals are served well by processing
literals in the lexer, as well as by reducing identifiers to
symbol-table indexes.


Now, when we write compilers in C (or even more powerful languages),
and have the luxury of keeping the entire parse tree in memory, it
doesn't matter...


Dale
[From Dale Worley <think!compass!worley@eddie.mit.edu.uucp>]
--


Post a followup to this message

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