Lispy is a programming language that is inspired by Scheme and Clojure. It's a simple Lisp-dialect I built to better understand Lisp and, more general

amirgamil / lispy

submited by
Style Pass
2021-06-05 03:00:04

Lispy is a programming language that is inspired by Scheme and Clojure. It's a simple Lisp-dialect I built to better understand Lisp and, more generally, functional programming. Here are some great resources I used to figure things out.

For a journal documenting my process from not knowing what Lisp was, to building this language, refer to this blog post I wrote.

Lispy is written as a tree-walk interpreter in Go with a recursive-descent parser. It also has a separate lexer, although most Lisp dialects are simple enough to parse that the lexing and parsing can be combined into one stage.

Because Lispy is interpreted, not compiled, it does not have a separate macro-expansion stage (that would typically be done before code is evaluated). Instead, Lispy handles macros as special functions, which it evaluates twice: once to generate the syntax of the code, and the second to run this generated syntax (as a macro would).

The interpreter code can be found at pkg/lispy/, the integration tests can be found at tests/ and the main Lispy library at lib/lispy.lpy. Here's a short sample of lispy in action:

Leave a Comment
Related Posts