Michael FIG | 17 Apr 07:32

jolt2: better jolt-burg compatibility

Hi,

The attached patch provides much better support for the jolt-burg
grammar features that aren't implemented in
function/jolt2/ColaGrammar.st.  Please reverse my last
jolt2-fixes.patch (if you applied it) before applying this one.

Inspired by OMeta, I added a new 'EXTENDS:' keyword (which can appear
after the grammar rules but before the optional start expression)
which allows you to import rules from another grammar.  The import
doesn't overwrite existing rules, and you can use EXTENDS: as many
times as you like.

With that established, I added a new ColaGrammar-derived grammar to
jolt2/boot.k that implements the missing features.  Reading that file
in conjunction with function/jolt2/ColaGrammar.st and the other
function/examples2 parsers should give you a good idea of how to use
jolt2's parsing features.  It should be possible to strip even more
out of ColaGrammar and put it into boot.k.  I'll leave that as an
exercise for the reader.

Maybe now would be a good time to update the Brainf*ck tutorial?

[Note that function/examples/peg still segfaults.  I haven't
investigated it yet, and I probably won't unless I'm really bored.]

Have fun,

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//

Attachment (jolt2-fixes.patch): text/x-diff, 13 KiB
Hi,

The attached patch provides much better support for the jolt-burg
grammar features that aren't implemented in
function/jolt2/ColaGrammar.st.  Please reverse my last
jolt2-fixes.patch (if you applied it) before applying this one.

Inspired by OMeta, I added a new 'EXTENDS:' keyword (which can appear
after the grammar rules but before the optional start expression)
which allows you to import rules from another grammar.  The import
doesn't overwrite existing rules, and you can use EXTENDS: as many
times as you like.

With that established, I added a new ColaGrammar-derived grammar to
jolt2/boot.k that implements the missing features.  Reading that file
in conjunction with function/jolt2/ColaGrammar.st and the other
function/examples2 parsers should give you a good idea of how to use
jolt2's parsing features.  It should be possible to strip even more
out of ColaGrammar and put it into boot.k.  I'll leave that as an
exercise for the reader.

Maybe now would be a good time to update the Brainf*ck tutorial?

[Note that function/examples/peg still segfaults.  I haven't
investigated it yet, and I probably won't unless I'm really bored.]

Have fun,

--

-- 
Michael FIG <michael@...> //\
   http://michael.fig.org/    \//


Gmane