|Incomplete compiler? Uwe.Uta.Altenburg@t-online.de (Uwe Altenburg) (2002-04-24)|
|RE: Incomplete compiler? firstname.lastname@example.org (Quinn Tyler Jackson) (2002-04-29)|
|From:||Quinn Tyler Jackson <email@example.com>|
|Date:||29 Apr 2002 01:52:30 -0400|
|Posted-Date:||29 Apr 2002 01:52:30 EDT|
> I would like to know, if there is a compiler (and a language) where I
> tell the compiler in the source-code how to compile the source? Let's
> say an "incomplete" or "simple" compiler that can be extended if
> needed or is this a "perpetuum mobile"?
> Thanks for comments
> [Look at the work done in the 1970s on extensible languages, where
> you could add BNF and semantics right in the middle of your program.
> It seemed like a cool idea but turned out to be useless. -John]
Extensible languages may not be of much use, but grammars that modify
themselves based upon the parse can be useful in NLP parsing*, and in
the case of languages such as HTML that can have tags that are
specific to certain browsers.
For instance, let us suppose that we wish to generate a proper tree
for an HTML parse, but we do not know in advance if some unknown tag
is supposed to be stand alone or balanced. If we go the traditional
route, we can accept unknown tags by having a default drop through
lexemes such as:
The trouble with such things is that the productions that accept these
will not produce a balanced tree.
In Meta-S**, however, it is possible for the grammar to learn during
the parse whether or not an unknown tag is balanced during a predicate
pass, and then reparse the input once this information is known,
producing a more appropriate tree on the second pass. This is also
useful in NLP, as discussed in [Jackson & Langan] below.
There are other uses of adaptation, such as symbol table generation
and semantic checking without need for ad hockery or attached code.
Of course, such grammars are Type 1, and therefore, prone to the
standard caveats (any grammar that modifies itself during a parse
cannot be known to terminate in a general sense, and the grammar
developer must therefore be careful to anticipate and handle
non-termination pathologies in user-supplied input that may be
* Quinn Tyler Jackson & Christopher Michael Langan, "Adaptive Predicates in
Empty-Start Natural Language Parsing," Noesis-E, Vol. 1 No. 6, Nov. 2001.
** DISCLAIMER: I am the author of Meta-S, a commercial adaptive grammar
My opinions are therefore biased.
Quinn Tyler Jackson
Return to the
Search the comp.compilers archives again.