OMeta for Scheme
July 1st, 2008 tonyg
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
darcs get http://www.eighty-twenty.org/~tonyg/Darcs/ometa-scheme/.
I’m already using it as part of an experimental compiler: the reader, the parser.
Entry Filed under: Technology, Reflection, Tools, Our Software
5 Comments Add your own
1. web design | July 3rd, 2008 at 4:42 am
For you Lisp2 fans, a common lisp version has been posted to reddit previously: http://subvert-the-dominant-paradigm.net/blog/?p=23
2. John Pallister | July 24th, 2008 at 11:48 am
Hi,
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. Simon Michael | July 25th, 2008 at 11:03 am
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 http://joyful.com/darcsweb/darcsweb.cgi?r=ometa-scheme;a=summary
4. John Pallister | July 27th, 2008 at 11:30 am
Thanks for that Simon, I’ll grab the latest code and try again.
Cheers,
John :^P
5. tonyg | August 1st, 2008 at 2:01 pm
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.
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed