Skip to content

Latest commit

 

History

History
89 lines (55 loc) · 2.63 KB

parse_trans_pp.md

File metadata and controls

89 lines (55 loc) · 2.63 KB

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::file:filename()) -> ok | {error, any()}

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(F::file:filename(), Out::file:filename()) -> ok | {error, any()}

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::parse_trans:forms(), F::file:filename()) -> ok

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