Home Ask Login Register

Developers Planet

Your answer is one click away!

zero_coding February 2016

How ex file is going to compile

When I have an elixir file and will compile it, what does the compiler do first? Compile ex to erlang or directly to bytecode?
When I write following code into session interaction

iex(4)> double = fn x -> x * 2 end
#Function<6.54118792/1 in :erl_eval.expr/5>

What does compiler do? Compile it to erlang or directly to bytecode?


Zoidberg February 2016

It compiles the code to an Erlang AST, which is then compiled to bytecode by the compile module from OTP. The relevant source code is in elixir_compiler.erl:

compile:noenv_forms([no_auto_import()|Forms], [return, {source, Source}|ErlOpts])

Post Status

Asked in February 2016
Viewed 3,135 times
Voted 4
Answered 1 times


Leave an answer

Quote of the day: live life