Function to syntax tree
bokner
boris.okner@REDACTED
Sun May 2 05:03:21 CEST 2010
Hi,
erl_scan and erl_parse can turn function represented by string into
AST. For example,
1> {ok, S, _} = erl_scan:string("fun(X) -> X+1 end."),
1> {ok, P} = erl_parse:parse_exprs(S),
1> [F] = P, erl_syntax:type(F).
fun_expr
My question is: how do I do the same, but with the function itself
instead string representation? I.e.,
F = fun(X) -> X +1 end,
AST = <some code turning F into AST>,
fun_expr = erl_syntax:type(AST).
Thanks,
Boris
More information about the erlang-questions
mailing list