[Tutor] bootstrapping

spir denis.spir at free.fr
Thu Apr 16 12:50:13 CEST 2009


This question is rather intended to people who have some knowledge on parser generation and/or on self-compiling languages.
I have a custom PEG parser generator in python, called 'pijnu', just bootstrapped. Meaning it's a kind of specific language which generator (compiler) is able to produce itself by parsing its own meta-grammar, written in itself. Here is a picture that tries to illustrate how this works:

text.lang    [langParser.py]    ==> textTree   [process.py]    ==> <result>
lang.pijnu   [pijnuParser.py]   ==> langTree   [generator.py]  ==> <langParser>
                    |                                                   |
                    v                                                   ^
pijnu.pijnu  [pijnuParser.py]   ==> pijnuTree  [generator.py]  ==> <pijnuParser>

* level 1: use of a parser generated by pijnu to parse a user text, then process further
* level 2: use of pijnu to generate a parser for a user language (or any other format)
* level 3: use of pijnu to generate its own parser

I'm an amateur and it's the first time I do such a thing. I thought a main advantage of bootstrapping was the ability to produce a compiler of next generation by feeding the present parser/generator with a modified grammar.

Actually, this does not work for me. The reason I guess is that a feature addition or modification (semantic level) usually comes with a change in the language itself (syntactic, or rather grammatical, level). This latter change will prevent the current parser to accept the modified grammar: I need then to introduce the change in the current parser itself instead of only in the grammar.
Is there anything wrong in my method and/or reflexion?

[I still find it worthful anyway to recursively produce the generator by itself, not only for intellectual satisfaction, but also as way to validate the change.]

la vita e estrany

More information about the Tutor mailing list