Skip to content

simplest interpreter for a lisp-like language , which uses json arrays.

Notifications You must be signed in to change notification settings

babak-karimi-asl/lisp-in-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

lisp-in-json

currently does not support function arguments and so many other things :)

how to use

import {LispInJson} from './lisp-in-json.js'

const lij = LispInJson()

lij.run([
    ['print',['*',5,6]], //30
    ['print',['/',12,6]], // 2
    ['print',['+',8,2]], // 10
    ['print',['-',1,10]], // -9
    ['print',['+',['-',['*',3,['/',20,4]],3],5]], // 17
])

other examples

create and access object fields

  lij.run([  
    ['$set','myObj',{a:{b:{c:'hello'}}}],
    ['print',['.',['$get','myObj'],'a','b','c'] ], // hello
  ])

creating and calling functions . (function arguments currently not supported)

   lij.run([
     ['$set','myNamespace/myFunction',['#','print','foo','bar','baz',['+',3,10]] ] ,
     ['call',['$get','myNamespace/myFunction']] , // foo bar baz 13
   ])

more examples in index.js file .

About

simplest interpreter for a lisp-like language , which uses json arrays.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published