This project consist of 3 level:
- 1 level - very simple Turing-complete language and its interpretator.
- 2 level - add variable declarations, code division by functions and functions call support.
- 3 level - add code generation with using LLVM IR.
- parse input file with using regular expressions (Flex) and grammatics (Bison)
- make an AST (Abstract Syntax Tree)
- code generation from the AST to LLVM IR
- link libraries and make an executable file with using clang++ compiler
To see examples, go to the tests folder.
var x = 1;
var y;
y = 5 + 6*x;
x = scan();
print(x*x);
var x = scan();
if x < 10
{
print(x);
}
while (x < 10)
{
x = x + 1;
print(x);
}
func sqr(x)
{
return x*x;
}