Skip to content

Building a subset of Lisp written in C to learn both languages - tutorial at http://www.buildyourownlisp.com

Notifications You must be signed in to change notification settings

bryanchun/build-your-own-lisp

Repository files navigation

build-your-own-lisp

Building a subset of Lisp written in C to learn both languages - tutorial at http://www.buildyourownlisp.com

Dependencies

  • cc compiler for Clang (change to gcc in clisp.sh at will)
  • mpc (Micro Parser Combinator) library, included in source already
  • Other standard C libraries: stdio.h, stdlib.h, math.h

How to use

To run the interactive console, pull this repository and then in your terminal, run:

# Each new revision of the 'clisp' language has its own file
# the latest being 'variables.c'
./clisp.sh variables

Features

  • S-Expression (evaluatable)
  • Q-Expression (can be written as code inside data)
  • Environment for containing variables defined and retrieving them
  • Functions (builtin)
    • Arithmetic (+, -, *, /, %, ^, max, min)
    • List-processing (list, head, tail, eval, join, cons, len, init)
    • Definition (def) for numerical variables so far, supporting tuple assignment (e.g. def {a b c} 1 2 3)
    • Exit (exit ())
    • All defined variables (env ())
  • Rich error reports and error-as-expression

About

Building a subset of Lisp written in C to learn both languages - tutorial at http://www.buildyourownlisp.com

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published