Hi Ian & Alan, Further to your suggestion that I write a LISP interpreter, I'm about 90% of the way done. That is, I've built the following so far:
- using Ruby - a Lexer into Ruby array structures for lists (Ruby Array & array of arrays (etc.) at this point in the process), Symbol, String, Integer & Float data types - base Lisp data types of ConsCell and using the Ruby Symbol class as Lisp Symbol/Atom. - an Environment class for holding a Dictionary which represents name definitions (ie to symbols, cons cells, lambdas and constant literals) - a base env (instance of Environment class) - a Parser for translating the ruby arrays from the lexer's output into ConsCell pairs, Symbols & constant literals - in the env, I've put the seven ruby base Lisp definitions as lambdas: atom, car, cdr, cond, cons, eq and quote - I've also put the two special operators... lambda & label... tho i haven't finished with these yet... - I've built a base-level evaluate. You guys weren't wrong! Man I've learned a HELL of a lot in the last two weeks! :) (But you knew that, right? hehe). So I've obviously got to finish the lambda code, and the evaluate function... but I've already got some interesting ideas brewing. I think I might need to go and "finish learning" Common Lisp, tho. It strikes me that there are a lot of exceptions in Lisp. It doesn't feel very regular (which is hilarious because it's one of the most regular languages I've ever used). I wonder, though if there is a way to build a more regular language. I wonder if I look at Maru again if I'll be absolutely excited :) I've learned a huge amount about cons cell structure - I thought I already understood them but I really didn't. Very interesting! I've already learned a huge amount about the original definition of LISP in the 1.5 manual. There were base functions in there I was wondering why anyone would need as a base function - until I started trying to write my own implementation and seeing the patterns crop up all over the place. Anyway I just wanted to give you guys an update report of where I'm up to... quite exhilarating building my own implementation. I'd like to make it compile down to machine code, but first I have to finish it up and make it at least able to get to a point where I can replace my ruby functions with Lisp ones (that's making it metacircular, right? Or is that only when I've made a compiler that can build itself?) Julian _______________________________________________ fonc mailing list fonc@vpri.org http://vpri.org/mailman/listinfo/fonc