Overview
Originally just a part of D/OS's shell, my
little lisp-like language interpreter class, Lispy, has found its way into
another project of mine: M3, and has been rewritten to be
more generally useful. I now intend to use it in a myriad of programs,
including various parts of D/OS as one of the two built in scripting languages.
Features
- Simple lisp like syntax of s-expressions.
- Full lexical closures
- Very easily extended, with both native code and script code, to fill
a specific use.
- Easy symbol aliasing by users
- Strongly typed (though, with just a few lines of code changed, this can change)
- Components can be changed out entirely by subclassing, if you so wanted.
- Small: under 1,000 lines of code (excluding comments).
- Written in the D programming language, for easy inclusion in other D programs.
Planned Features
- Lisp style macros that can be bound to a special symbol in the reader (like how 'x becomes (QUOTE x)) by you in native code or in the scripts.
- Continuations
- Alternate reader with a different syntax, biased toward string processing.
- Keyword arguments to functions.
- Adding some more generally useful functions and datatypes to the language.
- See also: the TODO list at the top of the code.
Downsides
- Speed and memory were not concerns when writing this. However, it hasn't been bad
in my experience, so it may also be fine for you.
- Limited types of data types. You have a list, symbol, string, integer, float, ratio, and function, but nothing more. (This has been enough for the tasks I wrote it for though thus far, and adding more types wouldn't be too hard to code up).
- The code is pretty messy right now.
- It isn't a complete LISP - it is just enough to do some basic tasks while
still being easy for advanced users to extend themselves.
Documentation
See the generated ddoc (still work in progress): here.
The language itself doesn't have much. It does basic math, defun, and
defmacro. The main point of this is to be extended with additional functions
by your code, specific for your own needs.
I assume you have some basic experience with Lisp in the docs.
Downloads
Mega work in progress: lispy.d
Simple standalone compile with dmd -version=standalone -J. lispy.d.
This program is licensed under the GNU GPL. I don't even guarantee it will
compile right now.
Future ideas
I am thinking about writing a subclass to Lispy that implements an alternative reader - one that reads syntax more similar to C (or at least,
regular mathematics), and converts it to the equivalent lisp forms for the
evaluator. It should be somewhat straightforward for the simple scope I
have in mind.
The interesting thing would be writing macros; they would probably still
just use the regular sexps.