Programming languages
Mini-Lisp
A Lisp interpreter in C++ with lexical scope, closures, macros, an interactive REPL, and script execution.
View source on GitHub
A small language runtime
Built for Peking University’s Software Design Practice course, Mini-Lisp supports both an interactive REPL and script execution. Its value types include numbers, booleans, strings, symbols, pairs, lists, procedures, and macros.
I implemented the tokenizer, parser, parent-linked lexical environments, closures, and special-form dispatch. Lists are represented using PairValue objects.
Language features
Special forms include define, lambda, if, begin, let, cond, short-circuiting and and or, quotation, and simple macros. Built-in procedures cover arithmetic, comparison, strings, I/O, and map, filter, and reduce.
(define-macro unless (cond body)
(quasiquote
(if (not (unquote cond))
(begin (unquote body))
())))
Limits
This is a teaching interpreter. Numbers use double, tail-call optimization is not implemented, and the standard library and error handling are intentionally small.
C++ · CMake