MISC: An experimental LISP-like language
Comments: 8 - Date: July 9th, 2008 - Categories: Programming
MISC has been a long time in the creation. It started when I got sick of XML’s lack of consistent structure and heavy markup. I wanted something consistent and clean like LISP but with a more general basic data structure. This was the initial spark “LISP with maps instead of lists”.
- [if [> 5 10] then:[+ 5 10] else:[– 5 10]]
- [let '[square:[lambda '[x:1] '[* x x]]]
'[square 12]
] - [take 20 [numbers from:0]]
After writing some example pseudo code to see what it would look like, I wrote a simple version in a couple of days. Since that speedy start the actual design with the complexities of a language have taken a very long time to finish. I changed the basic structure several times to fix major issues I hadn’t thought of and I switched the design from an eager language to a lazy language which I felt matched the base data structure of maps better.
I became interested in how rich metadata as basic part of the language and the source code could enable powerful reflective programming, like documentation built into source code. All these different ideas and designs added up and every time I thought “Would it not be easier if it just worked like language X,” I had to tell myself if it did there’d be no point in writing MISC. Thus the result is not a language for real-world use but one that I hope embodies many different unique and novel design decisions in a way that triggers thoughts and ideas in those that take the time to play with it.
What’s different and why you should be interested:
- Novel LISP-like language
- Homoiconicity (ie. source code that is data) using maps
- A great lazy data-language
- Cool stuff with metadata
- A metacircular– interpreter and syntax-colourer
Not only that; but it runs as an applet with some neat inline documentation: MISC
Comment by agnoster - July 9, 2008 @ 11:04 pm
From MISC 16: More on maps
“A short cut for the function get is to use back slashes to write values in a path-like syntax. /A/B/C is equivalent to [get [get A B] C].”
First – that’s a very nice convention. Is there a reason the initial slash is required?
But what I actually wanted to point out was that technically they are slashes, not backslashes :-)
All in all, a very nifty project. I’ve been doing a lot of thinking about homoiconicity recently, and how maps might play into it. It still seems like in this case maps don’t really give you anything plists and keyword arguments don’t in Lisp (apart from theoretically faster look-up and a more elegant metacircular interpreter) – but maybe I just haven’t thought about it enough. Although the metadata is a nice touch, and a natural use for maps – have you looked at clojure? It has a similar metadata feature using native map literals, but uses lists, arrays, and maps as part of the code. Since we use many data types, why not find matching semantics for those types in code, and not have to pick just one?
Pingback by del.icio.us bookmarks for July 9th, 2008 < Subject Code - July 10, 2008 @ 12:33 am
[…] Will Thimbleby » Blog Archive » MISC: An experimental LISP-like language – Interesting use of maps as the basic data structure. […]
Comment by admin - July 10, 2008 @ 9:07 am
As to why an initial slash is required — it allows quoting of the get chain. eg. ‘/A/B which is different from ‘A/B
Yes plists and keyword arguments in Lisp provide most of what maps do, but they do so at the expense, in my opinion, of turning a clean and consistent language into something a bit more ugly. Maps provide a consistent way for most of the data and they easily replicate lists and arrays. Consistency wins out over performance for me in this case.
Maps don’t provide any new computational abilities over lists, but I like their syntax, consistency, using them for arrays, keyword arguments, access of the environment etc. I did wonder “Why maps?” many times, but if I had used lists MISC wouldn’t be half as interesting.
Comment by ctc - July 11, 2008 @ 8:59 pm
Hy!
Do you have any public repository from where one can pull the source to play with it? I would like to look at it to see some of the implementations/design decisions in there.
It’s really interesting stuff
Comment by Hugh Shannon Myers - May 16, 2011 @ 2:55 pm
Broken input boxes in Firefox 3.6.17 make evaluation a bit difficult…
Comment by Joshua Cole - May 16, 2011 @ 3:18 pm
I second CTC, this looks very cool!
Comment by Alex - May 16, 2011 @ 4:04 pm
Heh. The syntax looks an awful lot like Objective-C. I mean, it’s totally different, but it looks a lot alike.
Comment by Piotr - May 16, 2011 @ 10:22 pm
Neat. I did a similar thing when I was in high school, only mine sucked. We made a programming language called Vinil. It was based on my misunderstanding of Lisp, and I based it primarily around dictionaries (but it did support lists). It was object oriented, with an object being just a dictionary mapping keywords to functions and data. We implemented an early web development system in it. I’m glad someone did this for real.
Leave a comment