Skip to content

keisen/minilisp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is an implementation of Lisp in less than 1k lines of C.  This language
can't do anything other than a simple math, but might be interesting to those
who want to see how dynamic scoping, macro system, and copying GC can be
implemented in C.

To compile:

  $ cc -o minilisp minilisp.c

Examples:

  (+ 1 2)
  ;; -> 3

  (define a 3)
  (+ a a)
  ;; -> 6

  (defun double (x) (+ x x))
  (double 6)
  ;; -> 12

  '(+ 1 2)
  ;; -> (+ 1 2)

  (defmacro if-zero (x then) (list 'if (list '= x 0) then))
  (macroexpand '(if-zero x (print x)))
  ;; (quote (if-not-zero x (print x)))
  (if-zero 0 42)
  ;; prints "42"

About

Mini Lisp with GC in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 96.8%
  • Common Lisp 3.2%