Boost logo

Boost :

From: joel de guzman (isis-tech_at_[hidden])
Date: 2001-06-10 19:22:48


----- Original Message -----
From: "John Max Skaller" :

> Now, using this styalised Spirit syntax, write a parser
> for styalised Spirit syntax.
>
> Compile this with C++. Execute the program on itself,
> and you have a yacc version of Spirit which generates
> yacc tables. So you have a version which is itself
> very fast and which generates very fast parsers.
>
> The use: first use C++ to prototype your grammar,
> then, after you are happy, you can compile a production
> quality parser using the spirit->yacc translator.
> This is also a 'C++' routine, but it is compiled
> rather than interpreted (in some sense).
>

This is certainly possible. This is really worth exploring.
So you use Spirit to do the prototyping and feed
the finished SBNF (spirit bnf) code to a translator
for a parser X (doesn't have to be yacc). In effect
using the stock parser in spirit as a RAD tool (fast
turn around, compile-debug cycle) and a front end
to different parser gens.

Did I get your idea correctly?

First I thought it cannot be bootstapped because
code in spirit is inlined. But on further thought, one
could segregate SBNF code in a *.sbnf file that
is included (e.g. #include <pascal.sbnf> ) in the
c++ code. This same SBNF code can be the
input file to a Spirit->X translator.

Cool!

Joel de Guzman

PS> There's this least-common-denominator effect though.
Inevitable?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk