RocketNIA.com > Miscellaneous Old Works
These are a couple of projects I did in my spare time in 2008, while I was going to Linfield College. Download these projects as a zip file, and you can take a look at their source code or run them (using Java).
Most of the rocketnia.com website is open source under the MIT license, including both of these projects.
During my side pursuits in college, I was reading about lisp dialects,
and I was especially enticed by
idealistic depiction of John McCarthy's original Lisp. Still, some
aspects of what I read about lisp dialects seemed needlessly
inconsistent, such as the non-function-like behavior of
and the non-
quote-like syntax of string literals.
I'd been formulating my own programming language syntaxes for a while before this, and something as simple as McCarthy's language seemed like a good place to start.
Unlike most lisp dialects, Jisp has macros that take unparsed
strings as input, rather than s-expressions. Here's an example, which
you can test for yourself by running
java com.rocketnia.hacks.jisp.Jisp" from the
> (if (eq 'apple (cdr (cons 'pine 'apple))) 'success 'failure) result: success > something-we-havent-defined result: () > (function-we-havent-defined 'symbol) result: (() (quote symbol)) > "( this is a string ) result: "( this is a string )" > (doublequote so is this ) result: "so is this" > "and-this result: "and-this" > (if (eq 'string (doublequote string)) (exit) 'whoops) result: whoops > (if (eq "string (doublequote string)) (exit) 'whoops) [The REPL terminates.]
Jisp has unified semantics for functions, special forms, macros, and string literals, making it easier to implement them all at once. Aside from the string part, it's similar to an fexpr-based lisp like Kernel, but I didn't know that at the time.
Jisp development stopped once I got through the initial challenge of
writing the parser. The implementation of
lambda is incomplete,
and there are no meaningful I/O primitives. I would rebuild this kind
of parser from scratch in later projects like
Penknife, and chops.js
(part of Lathe) rather than
maintaining the Jisp codebase.
During college, I found regexes inspiring. Whereas typical expression evaluation was good at assembling pieces into a whole, regexes were good for drilling down into existing structures and either replacing or extracting the pieces. I started making backtracking parser combinator libraries like this one so I could build regex-like systems for my own purposes.
Traditional regex systems require every lookbehind expression to have a maximum length known in advance. This library lifts that limitation. Every combinator has an interpretation that goes backwards, applying its match from the end of the string to the beginning.
Traditional regex systems have a backreference operator, to assert that a certain matched substring appears again at another location in the overall match. The mechanism I implemented here is somewhat more expressive: The parser combinators can collect multiple substring matches under a single name, and another combinator can take a look at this set and force a backtrack if not all the substrings are identical.
This code isn't very interactive; it's just a library. If you want to
see it in action anyway, you can run
java com.rocketnia.hacks.myregex.MyRegexTest", a rudimentary
unit test which does a single match.
© 2005–2010, 2013 Ross Angle (rocketnia)
This page was last updated 23-May-2013.