Skip to content

lctrt/nanolisp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Nanolisp

nanolisp is a small, extensible lisp to embed in JavaScript applications.

Installation and usage

npm install nanolisp
const lisp = require('nanolisp')();

lisp.run(`
(def foobar (add 1 2))
(echo foobar)
`);

Embedding custom libraries

To make this useful, you'll typically want to include libraries that are connected to your application context.

const nanolisp = require('nanolisp');

const appContext = {
    health: 400
};

const library = {
    takeDamage: (hit) => {
        appContext.health -= hit;
    },
    life: () => appContext.health
};

const lisp = nanolisp(library);

const result = lisp.run(`
    (echo life)
    (takeDamage 100)
    (echo life)
`);

Inspiration

This lisp is a fork from what was built for Ronin.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published