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

I am guilty of writing my own Scheme (R5RS) interpreter as well, and a key takeaway from the experience was that many things calling themselves Scheme interpreters are missing core parts of Scheme.

Implementing a language that resembles Scheme is quite easy. Implementing call-with-current-continuation and hygienic macros AND getting the tricky little details correct is not.[0] An analogy might be someone offering "ability to write SQL" for their fly-by-night database without stating up front that joins are not supported.

[0] Old test suite run against old Schemes: http://sisc-scheme.org/r5rs_pitfall.php



"Implementing a language that resembles Scheme is quite easy. Implementing call-with-current-continuation and hygienic macros AND getting the tricky little details correct is not."

(tangential) and this is where most "build your own compiler" style books fall down.

They teach you to implement ultra simple languages, but don't tackle memory management/garbage collection, concurrency, production grade typecheckers, and for lisplikes, macro systems, etc.


> (tangential) and this is where most "build your own compiler" style books fall down.

Have a look at http://t3x.org/s9book - it covers a Scheme implementation including GC, call/cc, low-level macros, type checking, tail call elimination, etc.


You will love Lisp in Small Pieces [0] then. :) It covers various lisps (mostly Scheme and Common Lisp) including how continuations can be implemented.

Hygienic macros are not hard to implement [1]. I can't speak to the efficiency of my implementation though.

[0] https://www.goodreads.com/book/show/1168500.LISP_in_Small_Pi...

[1] https://github.com/eatonphil/bsdscheme/blob/master/examples/...


Call/cc is pretty simple to implement depending on how you chose to represent your scheme code. Using CPS call/cc is trivial.

Hygienic macros are however never trivial. It is so many kinds of tricky, and together with the nice debugability of macros you find yourself in a nice place.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: