Skip to content

Instantly share code, notes, and snippets.

@teamon
Created September 21, 2017 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teamon/081955cd7fb0ea483c37efb2391f138f to your computer and use it in GitHub Desktop.
Save teamon/081955cd7fb0ea483c37efb2391f138f to your computer and use it in GitHub Desktop.
Decomile BEAM (erlang, elixir) into erlang with syntax highlighting
#!/usr/bin/env escript
% -*- mode: erlang -*-
main([BeamFile]) ->
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).
#!/bin/bash
# brew install highlight
decompile.escript $@ | highlight --syntax erlang --out-format ansi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment