ONLang/test.json5

92 lines
1.2 KiB
Text
Raw Normal View History

2022-08-02 21:07:10 +03:00
// Now the file with the extension .json5, but then it will be .onla
2022-08-02 17:58:00 +03:00
[
//print functions
2022-08-02 17:58:00 +03:00
{
print: ["Hello world", "! ", 1, "\n", ["wow"]],
2022-08-02 17:58:00 +03:00
},
{
println: ["Hello", "world", "!"],
2022-08-02 17:58:00 +03:00
},
{
print: "Fool",
},
"Really?",
[2, "Yes \n", true],
true, //throw error
//Exit functions
"Exit",
"ErrExit",
2022-08-02 21:07:10 +03:00
//TODO CONCEPTS ---------------------
//variables------------
//defining variables
{
let: {
var: "value",
anotherVar: true,
},
},
//print variables
{ print: "@var" },
["This is ", "@var"],
//assign variables
{
assign: { var: "newvalue" },
},
//-------------------
//math--------------
{
calc: ["@var", "+", 1],
},
//or
{
calc: ["@var", "+", { calc: [1, "*", 2] }],
},
//------------------
//comparison--------
{
comp: [1, ">=", "@var"],
},
//or
{
comp: [
{ comp: [{ calc: [1, "+", 1] }, ">", 1] },
"&&",
{ comp: ["@var", ">=", 2] },
],
},
//------------------
//cycles
{
loop: [
{
let: {
var: "val",
},
},
"@var",
],
},
{
while: {
cond: { comp: [1, ">=", "@var"] },
body: [
//commands
],
},
},
2022-08-02 17:58:00 +03:00
]