There are two versions. The original version
has been described in various forums (such as ) and is
preserved both as a reference implementation for those descriptions
and as an almost-minimal proof of concept. The current version has departed from and expanded on
the original, and is where new development is being done. Parts of it
have also been described in various forums (such as ) and so
keeping both versions publicly accessible seems expedient.
The original version
The whole thing is 1750 lines of code (about twice what it should be) and includes a garbage collector and user-level implementations of user-defined types and structures, single-dispatch object-oriented "messaging", and generic "multimethods" (all of which are needed by the compiler). The compiled binary code runs at about 30% the speed of aggressively-optimised C.
Maru runs on Linux, Darwin (Mac OS X) and Windows (Cygwin and/or MinGW). On Linux just type make, otherwise edit the first part of emit.l appropriately first.
The recursive implementation and compiler (in the three .l files) is split into three parts for clarity, but they could all be in a single source file.
The s-expression language has a few interesting characteristics some of which are exhibited by the way user-defined types and structures are implemented, and the way object-oriented single-dispatch messaging and generic functions (multimethods) are added to the language at runtime in boot.l. The compiler makes some attempt to be small and simple, and no attempt whatsoever to optimise.
The performance figure of 30% of optimised C was calculated by
comparing the time needed for generating eval.s
by eval and boot-eval. (The
C-compiled boot-eval gains a significant advantage by
inlining the entire implementation of the critical
function assq into callers in several places.)
The current version
You might like to...
Download the source code: maru-2.4.tar.gzAs usual, if you have questions or sugestions then please send them to me (ian at the domain name of this web site) or feel free to discuss them on the FoNC mailing list (which has some relationship with, but is not specifically about, Maru).
Browse the source code: maru-2.4
Read the manual page: if and when I get round to it
Copyright (c) 2010–2012 Ian Piumarta All Rights Reserved Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, provided that the above copyright notice(s) and this permission notice appear in all copies of the Software. Inclusion of the the above copyright notice(s) and this permission notice in supporting documentation would be appreciated but is not required. THE SOFTWARE IS PROVIDED 'AS IS'. USE ENTIRELY AT YOUR OWN RISK.