Skip to content

The Epic JDSL (JSON-Based Domain Specific Language). Inspired by Tom. A Turing-complete masterpiece where syntax is valid JSON.

Notifications You must be signed in to change notification settings

copyleftdev/JDSL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Epic JDSL

Epic JDSL Logo

"The Epic JDSL" is a Turing-complete programming language where the source code is valid JSON.

The Lore

You like JSON? You like Domain Specific Languages? You like Tom? Here is the ultimate convergence: JDSL.

Specification

Types

  • Variables: Immutable by default (?), but we support reassignment.
  • Data Types: String, Number, Boolean, Null, Array, Object (standard JSON).

Syntax

A program is a JSON Array of Instructions.

[
  {"instruction_1": "args"},
  {"instruction_2": "args"}
]

Core Instructions

Variables

  • let: Define a new variable.
    {"let": "myVar", "value": 123}
  • set: Update an existing variable.
    {"set": "myVar", "value": 456}

Operations (op)

Perform an operation and return a value. Can be nested. Arguments can be literals or variable references {"var": "name"}.

Supported ops: add, sub, mul, div, eq, lt, gt, concat.

{"op": "add", "args": [{"var": "x"}, 10]}

Control Flow

  • if: Conditional execution.
    {
      "if": {"op": "eq", "args": [{"var": "x"}, 0]},
      "then": [...],
      "else": [...]
    }
  • while: Loops.
    {
      "while": {"op": "lt", "args": [{"var": "x"}, 10]},
      "do": [...]
    }

I/O

  • print: Print to stdout.
    {"print": "Hello World"}

Usage

Run the interpreter with a .jdsl file:

zig build run -- program.jdsl

About

The Epic JDSL (JSON-Based Domain Specific Language). Inspired by Tom. A Turing-complete masterpiece where syntax is valid JSON.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages