Skip to content

Commit

Permalink
generated edown docs + added README
Browse files Browse the repository at this point in the history
  • Loading branch information
Ulf Wiger committed Oct 23, 2010
1 parent 363c2ed commit c0bfe08
Show file tree
Hide file tree
Showing 17 changed files with 775 additions and 664 deletions.
16 changes: 16 additions & 0 deletions README.md
@@ -0,0 +1,16 @@
Parse Transform Utility Library
===============================

This application contains some utility functions that
make it easier to write maintainable parse transforms
for erlang. The library uses Syntax Tools, which may seem
unwieldy at first. However, I recommend getting acquainted
with Syntax Tools; it has many advantages in for parse
transforms.

Documentation
-------------
The EDoc is generated using the EDown extension, in order
to make it easy to read online on Github. To generate
normal edoc, update `rebar.config` to remove the edown-
related dependencies and edoc options.
93 changes: 93 additions & 0 deletions doc/README.md
@@ -0,0 +1,93 @@


#The parse_trans application#
The parse_trans application
===========================
A generic parse transform library
This library is intended to simplify the task of writing parse transform
modules for Erlang.
__Authors:__ Ulf Wiger ([`ulf.wiger@erlang-consulting.com`](mailto:ulf.wiger@erlang-consulting.com)).
A generic parse transform library
This library is intended to simplify the task of writing parse transform
modules for Erlang.



#Introduction to parse transforms#




##The simplest transform##



The very simplest transform we can make is one that doesn't
change a thing. For convenience, we will at least print the forms.
This will enlighten us as to what the forms actually look like.


<pre>
-module(test_pt).

-export([parse_transform/2]).

parse_transform(Forms, _Options) ->
io:fwrite("Forms = ~p~n", [Forms]),
Forms.
</pre>



Trying this with a very simple module:


<pre>
-module(ex1).
-export([add/2]).

add(X,Y) ->
X + Y.
</pre>



<pre>
1> c(ex1, [{parse_transform,test_pt}]).
Forms = [{attribute,1,file,{"./ex1.erl",1}},
{attribute,1,module,ex1},
{attribute,2,export,[{add,2}]},
{function,4,add,2,
[{clause,4,
[{var,4,'X'},{var,4,'Y'}],
[],
[{op,5,'+',{var,5,'X'},{var,5,'Y'}}]}]},
{eof,6}]
{ok,ex1}
</pre>




##`transform/4`##


...




#Current limitations#


...


##Modules##

<table width="100%" border="0" summary="list of modules">
<tr><td><a href="ct_expand.md" class="module">ct_expand</a></td></tr>
<tr><td><a href="exprecs.md" class="module">exprecs</a></td></tr>
<tr><td><a href="parse_trans.md" class="module">parse_trans</a></td></tr>
<tr><td><a href="parse_trans_codegen.md" class="module">parse_trans_codegen</a></td></tr>
<tr><td><a href="parse_trans_pp.md" class="module">parse_trans_pp</a></td></tr></table>
45 changes: 0 additions & 45 deletions doc/ct_expand.html

This file was deleted.

49 changes: 49 additions & 0 deletions doc/ct_expand.md
@@ -0,0 +1,49 @@
Module ct_expand
================


#Module ct_expand#
* [Description](#description)
* [Function Index](#index)
* [Function Details](#functions)
Compile-time expansion utility.
__Authors:__ : Ulf Wiger ([`ulf.wiger@erlang-solutions.com`](mailto:ulf.wiger@erlang-solutions.com)).

##<a name="description">Description</a>##

Compile-time expansion utility


This module serves as an example of parse_trans-based transforms,
but might also be a useful utility in its own right.
The transform searches for calls to the pseudo-function
`ct_expand:term(Expr)`, and then replaces the call site with the
result of evaluating `Expr` at compile-time.


For example, the line


`ct_expand:term(lists:sort([3,5,2,1,4]))`

would be expanded at compile-time to `[1,2,3,4,5]`.


##<a name="index">Function Index</a>##

<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#parse_transform-2">parse_transform/2</a></td><td></td></tr></table>

<a name="functions"></a>


##Function Details##

<a name="parse_transform-2"></a>


###parse_transform/2##


`parse_transform(Forms, Options) -> any()`

_Generated by EDoc, Oct 23 2010, 21:00:45._
122 changes: 0 additions & 122 deletions doc/exprecs.html

This file was deleted.

0 comments on commit c0bfe08

Please sign in to comment.