"The Epic JDSL" is a Turing-complete programming language where the source code is valid JSON.
You like JSON? You like Domain Specific Languages? You like Tom? Here is the ultimate convergence: JDSL.
- Variables: Immutable by default (?), but we support reassignment.
- Data Types: String, Number, Boolean, Null, Array, Object (standard JSON).
A program is a JSON Array of Instructions.
[
{"instruction_1": "args"},
{"instruction_2": "args"}
]let: Define a new variable.{"let": "myVar", "value": 123}set: Update an existing variable.{"set": "myVar", "value": 456}
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]}if: Conditional execution.{ "if": {"op": "eq", "args": [{"var": "x"}, 0]}, "then": [...], "else": [...] }while: Loops.{ "while": {"op": "lt", "args": [{"var": "x"}, 10]}, "do": [...] }
print: Print to stdout.{"print": "Hello World"}
Run the interpreter with a .jdsl file:
zig build run -- program.jdsl