Skip to content

robbrit/xjson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wat

It's an interpreter for Lisp-styled JSON.

Example:

var xjson = require("xjson").xjson;

console.log(xjson(["+", 5, 9]));  // outputs 14

// factorial
var fact =
  ["defun", "fact", ["n"],
    ["if", ["=", 0, "n"],
      1,
      ["*", "n", ["fact", ["-", "n", 1]]]]];

// tail-recursive factorial (there is no TCO at the moment though)
fact =
  ["defun", "fact", ["n"],
    ["defun", "factn", ["a", "i"],
      ["if", [">", "i", "n"],
        "a",
        ["factn", ["*", "a", "i"],
                  ["+", "i", 1],
                  "n"]]],
    ["factn", 1, 1]];

xjson(fact);
xjson(["display", ["fact", 5]]); // outputs 120

Installation

npm install xjson

Licensing

MIT License

About

Lispy-style JSON programming language.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published