Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have often wondered what it would be like to have an "all-levels" Lisp-like language. Start with a bootstrapping reader that attaches to a minimal assembler that generates bytecode from the S-expressions. Then build progressively higher levels onto that until you have a "proper" lisp system, except you can drop to a lower level anytime and hack the depths of it when you need to.



Have you ever looked at Forth? It's postfix and stack-based, but is exactly what you want from the standpoint of bootstrapping from next-to-nothing and getting a high-level language.

Here's thoroughly documented source for a Forth interpreter (http://www.annexia.org/forth) in i386 assembly.



Brilliant, thanks. I'll have to have a play with that.


While you're at it, check out http://piumarta.com/ ;)


Indeed. The peg parser generator is quite nice: http://piumarta.com/software/peg/

I recently used it to implement an s-expression reader: http://zwizwa.be/darcs/libprim/ex/sexp.leg

(It's incomplete, but it illustrates the principle: peg parsing is very nice for quick & dirty parsing work.)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: