[erlang-questions] Reverse Compiling Erlang AST to Erlang

Ulf Wiger <>
Fri Mar 20 14:57:20 CET 2015


There is some stuff in parse_trans to help.

1. parse_trans_pp.erl, which is designed to be used via escript as well
https://github.com/uwiger/parse_trans/blob/master/doc/parse_trans_pp.md <https://github.com/uwiger/parse_trans/blob/master/doc/parse_trans_pp.md>

2. parse_trans_codegen.erl, for generating ASTs.
https://github.com/uwiger/parse_trans/blob/master/doc/parse_trans_codegen.md <https://github.com/uwiger/parse_trans/blob/master/doc/parse_trans_codegen.md>
https://github.com/uwiger/parse_trans/blob/master/examples/ex_codegen.erl <https://github.com/uwiger/parse_trans/blob/master/examples/ex_codegen.erl>

3. Accidentally undocumented are the compile options ‘pt_pp_src’ and 
   ‘pt_log_forms’, which instruct the parse_trans transforms to either pretty-print
  the resulting source, or to write the AST, into a separate file. 

BR,
Ulf W

> On 20 Mar 2015, at 09:30, Gordon Guthrie <> wrote:
> 
> Folks
> 
> I am generating some Erlang modules on the fly by generating ASTs.
> 
> For expository and code review processes I would like to be able to output the corresponding Erlang source code.
> 
> I have a hazy memory that this can be done, but damned if I can remember how...
> 
> Gordon
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150320/b9038590/attachment.html>


More information about the erlang-questions mailing list