A programming language created in C++
- Variables
- If statements
- For loops
- While loops
- Functions
- Lists
- Strings
- Arithmetic Operators
- Comparison Operators
- Logical Operators
- Control Statements
- Comments
- Scopes (outside a function)
- Classes
- Modules
- Error Handling
- Maps / Dicts
- File IO
// This is a comment :)
incl "math"
fn join($elements, $seperator) {
val $result is ""
val $len is $elements->length()
for $i in 0..$len {
$result is $result + str($elements->at($i))
if $i != $len - 1 {
$result is $result + $seperator
}
}
return $result
}
fn fibonacci($n) {
val $a is 0
val $b is 1
val $result is []
for $i in 0..$n {
$result->append($a)
val $temp is $a
$a is $b
$b is $temp + $b
}
return $result
}
val $res is "Calculating fibonacci sequence up to 100...\n\n"
print($res)
val $fib is fibonacci(100)
print(join(fibonacci(100), " "))
$res is $res + join($fib, " ")
print("10 + 20 is...")
print(add(10, 20))
val $file_str is load_file("hello.txt")
print("File 'hello.txt' content: " + $file_str)
save_file("save.txt", $res)
View grammar.txt
to view the grammar