Re: True Name Spaces, when?
- From: L <L@xxxxxxxx>
- Date: Sun, 24 Feb 2008 15:52:14 -0700
Hans-Peter Diettrich wrote:
L wrote:
Just to confuse people.. I want to clear (or not clear) something up about single pass parsers.
The whole "single pass" phrase is kind of a misleading term..IMO.
Well, I never found "single pass" applied to parsers, only to compilers.
Parsers and Compilers are the same things...
In many senses.
The line is murky between parser and compiler.
I scan/parse/compiles stuff for a living.. at least some of it.
In the early days of computing a complete compiler didn't fit into memory, so it had to be splitted into multiple passes. In this case every pass used the output of the preceding passes, and did *not* parse the source files again.
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.
Then you'd have two distinct parsers, derived from distinct grammars. The first one checks for correct syntax only, the second one only processes syntactically correct source files.
Of course there must exist backtracking or other techniques, when a grammar requires lookahead in order to determine the applicable rules. The improper use of "productions" for parsing rules results from the concept of languages, whose grammars can be used to either produce or analyze sentences of the language. A parser instead does not produce sentences, it only processes given sentences.
There are many cases for example when someone uses a StringReplace() during a parse, which is actually is reseting part of the pass to not be a single pass any more... since you are rewinding when a replace is done.
A parser never modifies the source. What you mean is an application, that makes use of an parser. When that application modifies the input, it must resume parsing of the modified source at an appropriate place.
StringReplace or Pos() on a temporary buffer while passing.
There is no such thing as passing by once without analyzing things within the pass... unless what you are parsing/compiling is extremely trivial. At least, this is my experience with parsing.. but I also am greatly familiar with compilers, esp. the FPC sources and a Qompute language mode I have worked on for a few years off and on.
.
- References:
- True Name Spaces, when?
- From: Thomas Miller
- Re: True Name Spaces, when?
- From: Hans-Peter Diettrich
- Re: True Name Spaces, when?
- From: Alessandro Federici
- Re: True Name Spaces, when?
- From: Marc Rohloff [TeamB]
- Re: True Name Spaces, when?
- From: Henrick Hellström
- Re: True Name Spaces, when?
- From: Robert Giesecke
- Re: True Name Spaces, when?
- From: Hans-Peter Diettrich
- Re: True Name Spaces, when?
- From: L
- Re: True Name Spaces, when?
- From: Hans-Peter Diettrich
- True Name Spaces, when?
- Prev by Date: Re: Technical conferences in 2008
- Next by Date: Re: True Name Spaces, when?
- Previous by thread: Re: True Name Spaces, when?
- Next by thread: Re: True Name Spaces, when?
- Index(es):
Relevant Pages
|