DEV Community

Pavel
Pavel

Posted on

I built a JSON AST Interpreter — write & run programs in pure JSON!


I was just messing around and having fun with the idea — but it actually works!

Tired of parsing custom syntax? I built a simple Node.js interpreter that runs programs described entirely as JSON AST.

  • Programs = JSON files
  • No parsing — just walk the AST and execute
  • Great for LLMs, automation, education, or building visual programming tools

Example program:

{
  "type": "program",
  "body": [
    { "type": "declare", "name": "x", "value": { "type": "number", "value": 7 } },
    { "type": "declare", "name": "y", "value": { "type": "number", "value": 3 } },
    {
      "type": "call",
      "function": "print",
      "args": [
        { "type": "add", "left": { "type": "identifier", "name": "x" }, "right": { "type": "identifier", "name": "y" } }
      ]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Works out of the box, easy to extend, and perfect for machine-generated code (like LLMs or no-code).
Source & docs: github.com/Xzdes/json-interpreter

Would love feedback or ideas!

Top comments (0)