Skip to content

Chipmunk is a Lisp interpreter with partial support for compiling to JavaScript

License

Notifications You must be signed in to change notification settings

josh548/chipmunk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chipmunk

Chipmunk is a Lisp interpreter with partial support for compiling to JavaScript. It's implemented in TypeScript using the Deno runtime. The goal is to someday achieve self-hosting.

Example Program

Print the factorials of the numbers 1 to 10:

(do
  (def factorial (lambda (x)
    (if (= x 0)
      1
      (* x (factorial (- x 1))))))
  (print-line (map factorial (range 10))))

; prints "[1 1 2 6 24 120 720 5040 40320 362880]"

Command Line Interface

To start a Chipmunk REPL:

deno run src/index.ts

To run a Chipmunk program:

deno run --allow-read src/index.ts examples/game-of-life.ch

To compile a Chipmunk program to JavaScript:

# Unfortunately npm is required in order to use the "source-map" module to generate source maps for the compiled JavaScript
npm install

# Compile to JavaScript
deno run --allow-read --allow-env --allow-write src/compile.ts examples/game-of-life.ch

# Run the compiled JavaScript
deno run examples/game-of-life.js

To run tests:

deno test --allow-read --allow-env

Resources

About

Chipmunk is a Lisp interpreter with partial support for compiling to JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published