|
Boost : |
From: John Max Skaller (skaller_at_[hidden])
Date: 2001-06-12 12:04:34
joel de guzman wrote:
> 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?
Yes, except that you won't always want to bother.
You use this as an incentive to use Spirit: you aren't necessarily
constrained by the performance of the 'C++ executable' version.
Which means you can rest more easily about
performance vs. power.
> 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.
I think you have to specify a styalised subset.
> PS> There's this least-common-denominator effect though.
> Inevitable?
Of couse: yacc can only handle LALR(1) grammars.
Spirit can only handle 'Spirit' grammars. A yacc'ed
version of a Spirit grammar would only work if the
grammar was in the intersection.
But you might well start out with the simplest
grammar, get your tool working, then go back and
change the grammar (not necessarily the language
being parsed) so it would work on yacc too.
Or you might be happy with Spirit and not bother.
_knowing you have the choice_ makes acceptance
of Spirit easier.
BTW: this is only an interesting idea,
nothing more.
-- John (Max) Skaller, mailto:skaller_at_[hidden] 10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850 checkout Vyper http://Vyper.sourceforge.net download Interscript http://Interscript.sourceforge.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk