ONLang: json based programming language
Recently, a person gave me the idea of creating a programming language that runs on json. I really liked this idea. I thought it would be interesting to create such a language.
Idea
Everything starts with an idea. It was necessary to figure out how the command writing format would look like. The first ideas began to appear.
{print:["Hello world!"]}
or
[
{let:["var", "world!"],
{print:["Hello", var]}
]
Of course, these concepts will be reworked later.
Start of development
The Rust programming language was taken as the basis. Speed and security will help make the interpreter.
First features
Initially, functions for output to the console were written.
[
{print:[...arguments]},
{println: [...arguments]}
]
In order not to always write println, the ability to output strings or arrays was added without writing {println:[]}
[
"Hello world!",
["Hello ", "world!"]
]
To be able to add, subtract, compare values, the calc
and comp
functions was added.
[
{calc: [2, "*", 2]}, //return 4
{comp: [2, ">", 3] //return false
]
Further features
Then loops, declaration of variables, getting the values of variables, declaration of functions and conditions were added.
All functions that are now in ONLang are described here or in documentation
Examples
[
{loop:[{println: ["Endless loop!"]}]},
{
let: {var_name:"value"}
},
["var_name = ", {var:"var_name"}]
]
YAML support has also been added.
What will be added
Import other files.
Methods for types (arrays, objects, strings).
Type conversion.
What is this for?
For scripting fun.
If you can help improve the interpreter, then I will be grateful to you.
Subscribe to my newsletter
Read articles from Artemy Egorov directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by