Re: True Name Spaces, when?



L wrote:

The whole "single pass" phrase is kind of a misleading term..IMO.

IMO, during parsing there are several "inner sub passes" to make sure
syntax is right.. and things get fastforwarded/rewound while you are
analyzing stuff after or during the pass.. so it is not really a
single pass at all. It depends on how you visualize parsing, but I
don't see it as this one big pass that occurs.. rather I see a hole
bunch of mini passes, whether or not it included one big single pass
too, to make the whole thing work.

There may be fixups (or whatever you call them), but in fact, it is a
single pass, the compiler only reads forward, IOW, it doesn't have to
either do a rewind and read some passges twice, not does it have to do
a fast forward and read some parts in advance. Parts that are forward
declared must be fixed up (filled with life) as soon as their
definition is known: the compiler remembers the spots it has to fix up
in the parse tree and then fixes them as soon as it can (usually this
only means fixing up links - which were temporarily set to nil or some
such - with a link to real code). That does not mean that a part of the
source is parsed in advance or that some parts of the source must be
parsed twice. That is not necessary.

FWIW, the sources for the orginal Pascal compilers are freely available
(as Pascal source code). There you can see how this works. The current
compiler is more complex, but in fact still using the same techniques.
--
Rudy Velthuis [TeamB] http://www.teamb.com

"I'll moider da bum."
-- Heavyweight boxer Tony Galento, when asked what he thought of
William Shakespeare
.



Relevant Pages

  • RE: What is the future of Compiler ?
    ... Scanning and parsing have had a lot of research ... machine learning for Heuristics. ... traditional compiler tasks. ... funky scripting languages like Perl without using perl to do it, ...
    (comp.compilers)
  • Re: True Name Spaces, when?
    ... It depends on how you visualize parsing, ... the compiler remembers the spots it has to fix up ... I guess it is the way I visualize compiling and parsing... ... Rather, after the pass, or during the pass, there are several checks and sorts with pos() functions. ...
    (borland.public.delphi.non-technical)
  • Re: C-style Syntax Highlighting Tutorial
    ... There are a couple of steps to building a compiler. ... The next step is parsing. ... To do syntax highlighting, you have to perform the lexical analysis and the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Common misconceptions about C (C95)
    ... It covers optimization and spends a whole chapter on ... but the real meat is parsing since if you ... Compiler parsing is a simple mechanical process that is a small ... Can you explain why recursive descent is easy to implement manually ...
    (comp.lang.c)
  • Re: True Name Spaces, when?
    ... nowadays) for a compiler to have more than ... it can be parsed in one pass over the tokens. ... grammars or some parsing schemes, ... and sorts with pos() functions. ...
    (borland.public.delphi.non-technical)