Are you too smart for golang, but too dumb for rust?
Fear not, you are not alone!
RJ to the rescue - The brand new hipster language no one asked for
The AST is written as an acyclic graph. You can view any AST by running:
cargo run -- <FILE> --emit-astHowever, due to the memory structure making heavy use of ASTRefs (referenced by indexes in the AST pool)
it is very hard to reason about.
To output a graph in dot language you can run:
cargo run -- <FILE> --emit-ast-graphHere is an example on the following code:
fn fib(n: i32): i32 {
if n < 3 {
return 1
}
return fib(n - 1) + fib(n - 2)
}
cargo run -- test.rj --emit-ast-graph | dot -Tsvg > images/fib-ast.svg:
Takes in a file and parses it into an AST.
Not implemented Walks through the AST and resolves the identifiers and imports.
Not implemented Resolves and checks types.
Not implemented Translates the AST into RJ IR.
Not implemented Performs language specific optimisations on the RJ IR.
Not implemented Translates the RJ IR into LLVM IR