Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert an Elixir AST to an Erlang AST? Is it possible?

Is it possible to take a quoted Elixir expression (AST tree) like this:

quote do: 1 + 1
=> {:+, [context: Elixir, import: Kernel], [1, 1]}

And convert it to an Erlang AST?

I looked through the Code module as well as some of the Kernel modules looking for a function that did this but I didn't find anything. I am not even sure if this would be possible... I don't know how things like Elixir macros would be represented in Erlang AST.

Thanks in advance!

like image 997
Stratus3D Avatar asked Nov 14 '13 16:11

Stratus3D


1 Answers

There isn't currently a public API to do so. You could look into the elixir module to know how it is done but it is private API and it can be changed any time with no guarantee of compatibility, or even removed.

like image 159
José Valim Avatar answered Sep 30 '22 11:09

José Valim