Lx Lang will compile all Elixir file (.ex) to BeamVM and the compiler to an executable file independent of Beam. It is developed with V Lang
- To compile faster to BeamVM
- To make executable without beam
- Fast compiler Elixir files to Beam VM
- Compile Elixir File to native code (via V)
- Lexing
- Parser file in AST
- Binary Expressions
- Assignment Statement
- Function Statement
- Module Statement
- Symbols table
- Binary Erlang CodeGen
- Binary Vlang CodeGen
- Recreate compiler with Lx Lang
- List all files to compile, follow ther order from the module that has a 'main' function
- Compile all dependency files, at last the main module.
- Set summarized information about headers functions was defined in modules.
- Defer compilation warning. if is compiles many files and check dependency error, just wait to all files was compiled, and check if error persist, so thown.
- Parallel compilation. Using methods above to compile in parallel
- Using the TinyCC to compile to native
Imagine three files:
a.ex
defmodule A do
def main do
B.operation()
end
end
b.ex
defmodule B do
def operation do
1
end
def operation_two do
C.operation()
end
end
c.ex
defmodule C do
def operation do
2
end
end
In order to compile A module, we need ensure that B module is already compiled, that be we need ensure C module is already compiled. Ir order of compilation defined by requirement of the main module, all warnings about compilation in call extern function is defer until finish all compilations that will be re evaluated.
- Install gcc or tinycc
- Install V
- Install Erlang
- On terminal, execute
$ v run . repl
- Execute the tests suite with
./test.sh
bash script