[erlang-questions] core erlang ?

Torbjorn Tornkvist <>
Fri Jul 20 18:40:10 CEST 2007


I found the nice erlc switches +to_core and +from_core.
However, I get compiler error with +from_core using
the included program:

$ erlc +to_core add.erl
$ erlc +from_core add.core
./add.core:13: syntax error before: LITERAL

$ cat add.erl
-module(add).
-export([add/0,add/1,add/2]).

add() -> fun(X) -> add(X) end.
add(X) -> fun(Y) -> add(X,Y) end.
add(X,Y) -> X+Y.


Any ideas on what's going wrong ?

Cheers, Tobbe


Richard Carlsson wrote:
> Torbjorn Tornkvist wrote:
>> Is is possible to make the compiler to output the
>> Core Erlang for inspection somehow ?
>>
>> Also, is it possible to inject some Core Erlang into
>> the compiler for compilation ?
>>
>> Are there a nice API for this?
> 
> Yes, there are (undocumented) compiler options "to_core" and
> "from_core". Look around in lib/compiler/compile.erl for details.
> 
>      /Richard
> 




More information about the erlang-questions mailing list