JSONseq
Jump to navigation
Jump to search
Introduction
JSONseq, a JSON based language! It is made with Node.js. And this is an esolang where .json or JavaScript Object Notation files (not .jsonc files) are code instead of data (yay)!
Words (or instructions)
How they look like
Yes! You heard me right, words. Or basically Instuctions. They are these objects and they normally look like this:
{ "wd-name": "(word name here)", "arg1": "argument 1" ... "argN": "argument N" }
The words
There aren't as many to memorise as my Funky esolang (or i think so):
- SETVAR arg1: varname, arg2: value ---------------------------------- Sets variable
- CPVAR arg1: varname, arg2: varname --------------------------------- Copy variable
- PRNT arg1: string -------------------------------------------------- print PRNT-OUT-DT variable or arg1
- INP arg1: varname -------------------------------------------------- It doesn't work lol
- ADD arg1: varname, arg2: varname, arg3: varname -------------------- arg3 variable = arg1 variable + arg2 variable
- SUB arg1: varname, arg2: varname, arg3: varname -------------------- arg3 variable = arg1 variable - arg2 variable (yes)
- MUL arg1: varname, arg2: varname, arg3: varname -------------------- arg3 variable = arg1 variable * arg2 variable
- DIV arg1: varname, arg2: varname, arg3: varname -------------------- arg3 variable = arg1 variable / arg2 variable (yes) oh my god i dont like the next one
- ASSERT arg1: varname, arg2: varname, arg3: operator, arg4: code ---- arg3 can be "ls" for less "ls-eq" for less or equal "eq" for equal "gr" for greater "gr-eq" for greater or equal and code is an array that is like the sequence. (this is an isolated environment, i think, github copilot wrote some of this)
- JUMP arg1: line number-1 ------------------------------------------- Your average goto. doesn't care about global scope if is in isolated environment
- LOOP arg1: start, arg2: iterations, arg3: step, arg4: code --------- Loop, nothing else, also an isolated environment. gives you an ITERATION-N variable to you and also accessible in global scope
- EXIT arg1: code ---------------------------------------------------- Finally, a small one, exit with code 'code'
a lot.
How to create more words
You can't.
How does an empty boilerplate look like
It looks like this:
{ "sequence": [ { "wd-name": "EXIT", arg1: 0 } ] }
5 lines
Some programs
Hello world
{ "sequence": [ { "wd-name": "SETVAR", "arg1": "PRNT-OUT-DT", "arg2": "Hello, World!\n" }, { "wd-name": "PRNT" }, { "wd-name": "EXIT", "arg1": 0 } ] }
truth-machine
{ "sequence": [ { "wd-name": "SETVAR", "arg1": "INPUT", "arg2": "0" }, { "wd-name": "SETVAR", "arg1": "ZERO", "arg2": "0" }, { "wd-name": "SETVAR", "arg1": "ONE", "arg2": "1" }, { "wd-name": "ASSERT", "arg1": "INPUT", "arg2": "ZERO", "arg3": "eq", "arg4": [ { "wd-name": "PRNT", "arg1": "ZERO" }, { "wd-name": "EXIT", "arg1": 0 } ]}, { "wd-name": "PRNT", "arg1": "ONE" }, { "wd-name": "JUMP", "arg1": 4 } ] }
Source code
Get it on github: https://github.com/Muhtasim-Rasheed/JSONseq-Esolang
Running & other stuff
To run your project, run:
$ node ./path/index.js ./path/program.json
replace ./path/index.js to where the index.js file is located and ./path/program.json to program
don't forget the ./
If you want, make Improvements!
Don't hesitate to add your improvements to this page!