Re: True Name Spaces, when?



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.

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.

DoDi
.



Relevant Pages

  • Re: Adding a control variable
    ... The Add-Variable wizard parses the source files to figure out where to ... and caused the parser to break. ... >> Regards, ...
    (microsoft.public.vc.mfc)
  • Re: prefix for yacc/bison
    ... The grammars that yacc accepts are a subset ... the parser mechanisms to their hearts content. ... means a bounded lookahead bottom-up machine. ...
    (alt.os.linux)
  • Re: Why LL(1) Parsers do not support left recursion?
    ... LLparser generators exist, in contrast to LRparser generators. ... no infinite recursion can occur. ... grammars that are commonly used for those languages are ambiguous. ... upon an extragrammatical disambiguation rule. ...
    (comp.compilers)
  • Re: String#to_rx ?
    ... > I don't think trying to push full parser capabilities into regex's is ... > mechanism in ruby to build grammars - and easily put actions in. ... Perl 6 doesn't define the parser as a very complex string. ...
    (comp.lang.ruby)
  • TextTransformer wins BCB contest 2006
    ... The TextTransformer parser generator has been extended by an stand ... TextTransformer IDE, ... The TetraComponents wrap the compilation of grammars into interpreted ... from the above sources, as well as the use of the parser engine, when ...
    (comp.compilers)