erl_parse
, together with utilities for
reading source files in unusual ways and pretty-printing syntax trees.
Also included is an amazing automatic code-cleaner/checker.
epp_dodger
: Makes it
possible to parse most Erlang code without expanding preprocessor
macros.
erl_comment_scan
:
Extracts comment text from Erlang source files.
erl_prettypr
:
Flexible pretty-printer for abstract syntax trees.
erl_recomment
:
Inserts comments into an abstract syntax tree.
erl_syntax
: Abstract
syntax trees, compatible with erl_parse
trees.
erl_syntax_lib
:
Support functions for working with abstract syntax trees.
erl_tidy
: Automatic code
cleaner/checker. Can work directly on files, and recursively
traverse directories.
The abstract layer (defined in erl_syntax
) is nicely
structured, and the node types are context-independent. The layer makes
it possible to transparently attach source-code comments and user
annotations to nodes of the tree. Using the abstract layer makes
applications less sensitive to changes in the erl_parse
data structures, only requiring the erl_syntax
module to be
up-to-date.
The pretty printer (erl_prettypr
) is implemented on top
of the library module prettypr
: this is a powerful and
flexible generic pretty printing library, which is also distributed
separately, and is not documented here.
For a short demonstration of parsing and pretty-printing, simply
compile the included module "demo.erl
", and execute
demo:run()
from the Erlang shell. It will compile the
remaining modules and give you further instructions.
Also try the erl_tidy
module, as follows:
erl_tidy:dir("any-erlang-source-dir", [test, old_guard_tests]).(
test
assures that no files are modified).
See the README
file for changes since previous versions.