Erlang -- The Abstract Format

Getting Core Erlang from Elixir - scarfacedeb

To get AF from the already compiled module, you need to know the full path to the Hello.beam file, and pass it to :beam_lib:chunks :

defmodule Hello do
    def hello, do: :world
end
iex(11)> {:ok,{_,[abstract_code: ac]}} = \\
         Hello |> :code.which |> :beam_lib.chunks([:abstract_code])
####################################################################
{:raw_abstract_v1,
 [
   {:attribute, 1, :file, {'lib/hello.ex', 1}},
   {:attribute, 1, :module, Hello},

iex(11)> {_,ac} = ac
####################################################################
[
  {:attribute, 1, :file, {'lib/hello.ex', 1}},
  {:attribute, 1, :module, Hello},
  {:attribute, 1, :compile, [:no_auto_import]},
  {:attribute, 1, :export, [__info__: 1, hello: 0]},
  {:attribute, 1, :spec,
   {{:__info__, 1},
    [
      {:type, 1, :fun,
       [
         {:type, 1, :product,
          [
            {:type, 1, :union,
             [
               {:atom, 1, :attributes},
               {:atom, 1, :compile},
               {:atom, 1, :functions},
               {:atom, 1, :macros},
               {:atom, 1, :md5},
               {:atom, 1, :module},
               {:atom, 1, :deprecated}
             ]}
          ]},
         {:type, 1, :any, []}
       ]}
    ]}},
  {:function, 0, :__info__, 1,
   [
     {:clause, 0, [{:atom, 0, :module}], [], [{:atom, 0, Hello}]},
     {:clause, 0, [{:atom, 0, :functions}], [],
      [
        {:cons, 0, {:tuple, 0, [{:atom, 0, :hello}, {:integer, 0, 0}]},
         {nil, 0}}
      ]},
     {:clause, 0, [{:atom, 0, :macros}], [], [nil: 0]},
     {:clause, 0, [{:match, 0, {:var, 0, :Key}, {:atom, 0, :attributes}}], [],
      [
        {:call, 0,
         {:remote, 0, {:atom, 0, :erlang}, {:atom, 0, :get_module_info}},
         [{:atom, 0, Hello}, {:var, 0, :Key}]}
      ]},
     {:clause, 0, [{:match, 0, {:var, 0, :Key}, {:atom, 0, :compile}}], [],
      [
        {:call, 0,
         {:remote, 0, {:atom, 0, :erlang}, {:atom, 0, :get_module_info}},
         [{:atom, 0, Hello}, {:var, 0, :Key}]}
      ]},
     {:clause, 0, [{:match, 0, {:var, 0, :Key}, {:atom, 0, :md5}}], [],
      [
        {:call, 0,
         {:remote, 0, {:atom, 0, :erlang}, {:atom, 0, :get_module_info}},
         [{:atom, 0, Hello}, {:var, 0, :Key}]}
      ]},
     {:clause, 0, [{:atom, 0, :deprecated}], [], [nil: 0]}
   ]},
  {:function, 2, :hello, 0, [{:clause, 2, [], [], [{:atom, 0, :world}]}]}
]

Core Erlang deeply described in next section:

Hacking BEAM with Core Erlang