An interpreter for the Neko programming language written in Rust from scratch without using any third-party libraries.
Neko has a Assembly like syntax, supports variable bindings, mathematical operations, has functions and loops, has integers, float numbers, arrays and struct built-in.
-
Create a variable
var x 10 print x
-
If the else statement
var x 10 if x == 10 print x
-
Arithmetic operations
var x 30 var y 10 add x y print x end
-
Loop
var x 0 var y 1 loop x < 5 print x add x y end end
-
Array
[keyword == array] [name_of_variable] [size]
array arr 5 //keyword name_of_variable and size which is 5 1 2 3 4 5 // elements of array print arr
Right now array has a static size there is no possibility to make dynamic
-
String
string x hello, world endstring print x
-
Float
float x 10.34 print x float y 23.15 print y add_f x y print x
-
Function
function sum with // void function if after with set name of paramter it will be a function with parameter var a 10 print a end call sum
-
Struct
struct point x 2 y 3 z 4 endstruct print point
❎ Improving functions make it as type based functions and improve setting parameters
❎ Improving struct