parse_trans/doc/parse_trans_pp.md
2016-06-23 18:57:15 +02:00

2.4 KiB

Module parse_trans_pp

Generic parse transform library for Erlang.

Authors: : Ulf Wiger (ulf@wiger.net).

Description

This module contains some useful utility functions for inspecting the results of parse transforms or code generation. The function main/1 is called from escript, and can be used to pretty-print debug info in a .beam file from a Linux shell.

Using e.g. the following bash alias:


  alias pp='escript $PARSE_TRANS_ROOT/ebin/parse_trans_pp.beam'

a file could be pretty-printed using the following command:

$ pp ex_codegen.beam | less

Function Index

main/1
pp_beam/1 Reads debug_info from the beam file Beam and returns a string containing the pretty-printed corresponding erlang source code.
pp_beam/2 Reads debug_info from the beam file Beam and pretty-prints it as Erlang source code, storing it in the file Out.
pp_src/2Pretty-prints the erlang source code corresponding to Forms into Out.

Function Details

main/1


main(X1::[string()]) -> any()

pp_beam/1


pp_beam(Beam::filename()) -> string() | {error, Reason}

Reads debug_info from the beam file Beam and returns a string containing the pretty-printed corresponding erlang source code.

pp_beam/2


pp_beam(Beam::filename(), Out::filename()) -> ok | {error, Reason}

Reads debug_info from the beam file Beam and pretty-prints it as Erlang source code, storing it in the file Out.

pp_src/2


pp_src(Forms0::Forms, Out::filename()) -> ok

Pretty-prints the erlang source code corresponding to Forms into Out