Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get the output of Erlang's preprocessor?

I've got a weird macro that I'm debugging and I can't seem to figure out how to get the output of the preprocessor. I'm looking for the equivalent of GCC's -save-temps. I've tried passing dpp to compile:file/2, but it seems to generate a parse tree, not preprocessed Erlang.

compile:file("t.erl", 'E'). as mentioned by Anton is great, but doesn't help with macros that cause syntax errors. Lacking a way to debug complicated macros, I'm leaning toward doing my metaprogramming by writing programs that generate code.

like image 502
nmichaels Avatar asked Oct 19 '11 21:10

nmichaels


1 Answers

Try one of these:

   compile:file("t.erl", 'P').
   compile:file("t.erl", 'E').
like image 187
alavrik Avatar answered Oct 19 '22 16:10

alavrik