technology from back to front

OMeta for Scheme

Speaking of OMeta/JS and OMeta in general, I’ve implemented an OMeta for Scheme. Currently it runs in MzScheme, but it should be fairly portable, with dependencies only on a handful of commonly-implemented SRFIs. I intend to properly libraryise it — making it into a proper MzScheme module — and to port it to other schemes, most probably starting with SISC.

One interesting feature of this OMeta is that it implements the error-handling mechanisms suggested by Bryan Ford that I implemented previously in a packrat parsing library for Scheme. The packrat-based error-handling techniques seem to generalise fairly well to an OMeta setting.

* Browse the code here.
* Check it out with hg clone

I’m already using it as part of an experimental compiler: the reader, the parser.

Update: Switched from hosting the ometa-scheme code in Darcs to Mercurial.

  1. For you Lisp2 fans, a common lisp version has been posted to reddit previously:

  2. John Pallister
    on 24/07/08 at 11:48 am


    Thanks for making your code available. I’m a Lisper interested in OMeta, so between your Scheme code and John Leuner’s Lisp port of the Squeak version (as mentioned above) I hope to get (a) my head around OMeta and (b) some Lisp code of my own that I understand.

    I like your mention of extra (any?) error handling stuff, and the fact that your code is 803 lines of Scheme vs. 3000+ lines of Lisp and 5000+ lines of JavaScript… ;)

    And now my question: I’ve downloaded the latest MzScheme, but it looks like your code won’t run in version 4 out of the box (not that I’ve used this particular box before).

    If I want to study your code interactively, would I be best advised to download a slightly earlier version of MzScheme? Or should I hang on for the next release?

    Thanks again,

    John :^P

  3. Thanks for this, very timely.

    I made it work with PLT scheme 4, more or less – using enter! in a command-line mzscheme, at least. (boot) works, (opt (parse-ometa “a ::= ‘a’ => true;”)) works, I haven’t figured out how to parse actual data. See darcs repo at;a=summary

  4. John Pallister
    on 27/07/08 at 11:30 am

    Thanks for that Simon, I’ll grab the latest code and try again.


    John :^P

  5. John, Simon: Thanks for trying out the code — and thanks for the bug report. I’ve not yet upgraded to mzscheme 4, but will do so and integrate Simon’s patches ASAP.

  6. I’ve switched the repository from darcs to mercurial, and updated the links in the post above. I’ve also incorporated Simon’s fixes for MzScheme 4 — thanks, Simon!

    The situation now is that the default branch is the PLT 4 branch, and PLT 3 support is now legacy, and lives on a support branch.


five × 1 =

2000-14 LShift Ltd, 1st Floor, Hoxton Point, 6 Rufus Street, London, N1 6PE, UK+44 (0)20 7729 7060   Contact us