A JSON based retarded scripting language for Go.
JSONLang is the silliest scripting language ever intended for actual use.
Language specification:
Some fun facts:
*Lets take a look at the example source code:
isOdd(&is_odd, 3);
set(&x, { "val": is_odd });
set(&f, {"lol":{"trolol":22}});
println(f.lol.trolol);
println(x);
Now, if we replace "(" with ", " and ")" with nothing, we get:
isOdd, &is_odd, 3;
set, &x, { "val": is_odd };
set, &f, {"lol":{"trolol":22}};
println, f.lol.trolol;
println, x;
If we quote the unquoted strings and mark them with a special char:
".isOdd", ".&is_odd", 3;
".set", ".&x", { "val": ".is_odd" };
".set", ".&f", {"lol":{"trolol":22}};
".println", ".f.lol.trolol";
".println", ".x";
We can distingish between string constants and variable/function names.
We only have to replace ";" with "],\n [":
".isOdd", ".&is_odd", 3],
[".set", ".&x", { "val": ".is_odd" }],
[".set", ".&f", {"lol":{"trolol":22}}],
[".println", ".f.lol.trolol"],
[".println", ".x"
We add "[[" to the beginning and "]]" to the end, run it trough jsonlint.org:
[
[
".isOdd",
".&is_odd",
3
],
[
".set",
".&x",
{
"val": ".is_odd"
}
],
[
".set",
".&f",
{
"lol": {
"trolol": 22
}
}
],
[
".println",
".f.lol.trolol"
],
[
".println",
".x"
]
]
And we can use json.Unmarshal to decode our primitive language into a primitive AST.
Thank you for watching Useless Projects TV and don't forget to watch all the commercials, because taking a piss while they run is like robbing the cable company.
Oh, and by the way the above source code outputs:
22
map[val:true]