Esoteric programming language. The grammar is represented using JSON.
Program structure:
{
"program": "Program Name",
"import": [
// Files to import
],
"variables": {
// List of global variables
},
"code": [
// Code
]
}
Features supported:
- Global variables
- Local variables
- Function calls
- Function declaration
- Conditionals (if)
- Loops (for)
- Arithmetic & logic operations (
+
,-
,*
,/
,==
,!=
,<
,>
,&&
,||
) - Source file importing
Example JsonLang program:
{
"program": "Example Program",
"variables": {
"test": 123
},
"code": [
{"function": {
"name": "test",
"args": ["i"],
"code": [
{"if": {
"condition": {"==": [{"local": "i"}, 123]},
"then": {
"call": {"name": "print", "args": {"+": [{"local": "i"}, 1]}}
},
"else": {
"call": {"name": "print", "args": {"-": [{"local": "i"}, 1]}}
}
}}
]
}},
{"call": {"name": "test", "args": [{"var": "test"}]}}
]
}
- Clone the repo
- Run
main.py
The usage of main.py
is ./main.py [FILENAME]
.
FILENAME
is the file to run. Without arguments, it runs the REPL.
The REPL supports the following commands:
quit
- Exits the REPLhelp
- Prints help msgreset
- Resets the runtime (state)env
- REPL environment variablesvar
- Runtime variableslocals
- Prints local variablefunc
- Prints the list pf functionslist
- Lists programsload
- Loads a programrun-prog
- Runs a programrun-func
- Runs a function