Erlang Parse_trans Form转换为Erlang源代码
通过使用parse_trans,我得到了模块的形式。。然后我正在对它做一些修改。。有没有办法将表单转换回实际的erlang代码?请说明以下表格:Erlang Parse_trans Form转换为Erlang源代码,erlang,Erlang,通过使用parse_trans,我得到了模块的形式。。然后我正在对它做一些修改。。有没有办法将表单转换回实际的erlang代码?请说明以下表格: [{attribute,1,file, {"/program.erl", 1}}, {attribute,1,module,program}, {attribute,3,export,[{run,0}]}, {function,5,run,0, [{clause,5,[],[],
[{attribute,1,file,
{"/program.erl",
1}},
{attribute,1,module,program},
{attribute,3,export,[{run,0}]},
{function,5,run,0,
[{clause,5,[],[],
[{match,5,
{var,5,'T'},
{cons,5,
{atom,40,program},
{cons,5,{atom,40,...},{cons,...}}}},
{call,5,
{remote,5,{atom,5,advices},{atom,5,before_advice}},
[{var,5,'T'}]},
{match,5,{var,5,'R'},{call,5,{atom,5,run_@},[]}},
{var,5,'R'}]}]},
{function,5,run_@,0,
[{clause,5,[],[],
[{call,6,
{remote,6,{atom,6,program2},{atom,6,calc_service}},
[{integer,6,1},{integer,6,0}]},
{call,7,
{remote,7,{atom,7,program2},{atom,7,calc_service}},
[{integer,7,2},{integer,7,2}]},
{call,8,
{remote,8,{atom,8,program2},{atom,8,process_message}},
[{string,8,"Add 3 to 5"}]},
{call,9,
{remote,9,{atom,9,program2},{atom,9,...}},
[{string,9,"Message to process"}]},
{call,10,{remote,10,{atom,10,...},{atom,...}},[]},
{atom,11,ok}]}]},
{eof,11}]
您可以从parse_trans应用程序使用pretty printer:您可以从parse_trans应用程序使用pretty printer:使用。 以下是一个例子:
parse_transform(Forms, _Options) ->
IOList = [erl_pp:form(Form) || Form <- Forms],
io:format(user, "~s", [IOList]),
Forms.
parse\u转换(表单、选项)->
IOList=[erl_pp:form(form)| formUse。
以下是一个例子:
parse_transform(Forms, _Options) ->
IOList = [erl_pp:form(Form) || Form <- Forms],
io:format(user, "~s", [IOList]),
Forms.
parse\u转换(表单、选项)->
IOList=[erl_pp:form(form)| | form