JSON.lang

From Esolang
Jump to navigation Jump to search

JSON.lang is an esoteric programming language created by User:GNUian Linuxist Party in 2025. It is designed around a JSON-based instruction set, with **functions, variable scopes, and expression evaluation**.

Syntax

JSON.lang programs are written as lists of tuples, where the first element in the instruction tuple is the instruction and the rest are arguments. The language has a **global scope** and **nested local scopes** for variables/functions.

Basic instructions:

  • `var name value` – define or assign a variable.
  • `func name [params] [body]` – define a function with parameters and body.
  • `return value` – return a value from a function.
  • `if (condition) [then_body] [else_body]` – conditional execution.
  • `while (condition) [body]` – loop while condition is true.
  • `for var_name iterable [body]` – iterate over items.
  • `print *values` – output values.
  • Expressions: `+`, `-`, `*`, `/`, `%`, `==`, `!=`, `<`, `>`, `<=`, `>=`, `and`, `or`, `not`, maybe more?

---

Examples

Hello world (printing a value): <syntaxhighlight lang="JSONdotLang"> [

 ("print", "Hello World!")

] </syntaxhighlight>

Function definition and call: <syntaxhighlight lang="JSONdotLang"> (

 ("func", "add", ["a", "b"], [
   ("return", ("+", "$a", "$b")
 ]),
 ("print", ("add", 5, 7))

) </syntaxhighlight>

Variable assignment: <syntaxhighlight lang="JSONdotLang"> [

 ("var", "x", 42),
 ("print", "$x")

] </syntaxhighlight>

Conditional: <syntaxhighlight lang="JSONdotLang"> [

 ("var", "x", 10),
 ("if", ("==", "$x", 10), [
   ("print", "x is ten")
 ], [
   ("print", "x is not ten")
 ])

] </syntaxhighlight>

Looping: <syntaxhighlight lang="JSONdotLang"> [

 ("var", "i", 0),
 ("while", ("<", "$i", 5), [
   ("print", "$i"),
   ("var", "i", ("+", "$i", 1))
 ])

] </syntaxhighlight>


...more things will be implemented soon, like user input, datatypes like Dicts/sets and lists, and file management. ---

Interpreters

Well, this Language still unstable, but the official interpreter coded in Python <sadly :)> You can find the official interpreter in the GitHub repo down in "External links" section ---

See also

---

External links