Commit Graph

38 Commits

Author SHA1 Message Date
Ulf Wiger
072a7ef0ab exprecs now also generates functional lenses 2013-01-24 21:17:46 +01:00
Ulf Wiger
895a157dc9 improved error reporting, return/2, format_exception/2 2012-12-18 15:50:17 +01:00
Ulf Wiger
38b2183a9e added LC form to codegen:gen_function/2 2012-12-14 22:57:47 +01:00
Ulf Wiger
ae7163f3db For fun, implemented a 'pmod' parse transform.
See examples/pmod.erl and examples/ex_pmod.erl
This works similarly to OTP's parameterized modules, which they are
now saying that they will drop. Since they drop the compiler support,
a slightly different notation is needed.

-pmod_vars([V1, V2, ...]). % defines the 'global' variables.
-pmod_funs([F1/A1, ...]).  % defines which functions are to be exported.

The functions listed in -pmod_funs/1 are transformed to take an extra
argument, and a new(V1, V2, ...) function is added and exported.

Example:

Eshell V5.9  (abort with ^G)
1> c(ex_pmod).
{ok,ex_pmod}
2> M = ex_pmod:new(a,b).
{ex_pmod,{a,b}}
3> M:b(x,y).
{x,y,a,b}
2012-10-12 19:34:03 +02:00
Ulf Wiger
f84867ab1a fix function_clause crash in exprecs + minor fixes 2012-02-05 23:12:49 +01:00
Ulf Wiger
9116c6e385 figured out how to abstract erl_eval funs 2012-01-28 18:32:33 +01:00
Ulf Wiger
a58d7dab1e nicer error reporting; more capable ct_expand 2012-01-28 16:23:53 +01:00
Ulf Wiger
60b548ab27 parse_trans:plain_transform/2 and example 2011-12-01 13:32:26 +01:00
Ulf Wiger
661d1689e5 fix typo in test_exprecs_vsns printout 2011-11-22 11:36:01 +01:00
Ulf Wiger
5b2201f39f fix record conversions + add example 2011-11-22 10:30:45 +01:00
Ulf Wiger
e9d307f1fc exprecs naming rules can be redefined 2011-10-28 12:26:52 -07:00
Ulf Wiger
676ed9a44b pretty_print handles typed records; exprecs gets more type specs 2011-10-25 14:11:00 -07:00
Ulf Wiger
bb57e235ff types added in exprecs 2011-10-23 13:52:05 +02:00
Ulf Wiger
5c634120c0 optional pretty-printing in transform_module 2011-10-18 11:42:18 +02:00
Ulf Wiger
69b05f4de2 add parse_trans_mod & transform example 2011-10-18 11:24:48 +02:00
Ulf Wiger
62d2cf4984 added eunit example, fixed is_record bug 2011-06-06 14:49:43 +02:00
Klas Johansson
1ec65427e4 Inject an abstract form when '$form' is seen
'$form' works much like '$var', only that it makes it possible to
inject ready-made abstract forms into the generated
functions/expressions.  The following call:

  gen(Name, F) ->
     codegen:gen_function(Name, fun(X) -> X =:= {'$form',F} end).

generates the following if called like this: gen(is_foo, {atom,0,foo})

  is_foo(X) ->
     X =:= foo.
2010-10-26 21:23:11 +02:00
Ulf Wiger
488dc61f56 added codegen: gen_functions/1, expr/1 2010-09-05 14:32:59 +02:00
Ulf Wiger
0f2fc09ab2 edoc for parse_trans_codegen 2010-07-02 06:39:05 -04:00
Ulf Wiger
6e34855ffb codegen variable substitution 2010-06-22 16:16:11 +02:00
Ulf Wiger
c318a5fb47 first draft of parse_trans_codegen.erl 2010-06-22 12:37:08 +02:00
Ulf Wiger
6b9510fa74 added pos functions to exprecs 2010-02-25 07:34:17 -05:00
uwiger
11201b9125 examples Makefile
git-svn-id: http://svn.ulf.wiger.net/parse_trans/branches/0.2/parse_trans@22 ae7daa23-5771-0410-ae54-ec81a0701e84
2010-01-07 17:51:31 +00:00
uwiger
e44edda673 moved exprecs and ct_expand into src, removed wooper src
git-svn-id: http://svn.ulf.wiger.net/parse_trans/branches/0.2/parse_trans@21 ae7daa23-5771-0410-ae54-ec81a0701e84
2010-01-07 17:17:43 +00:00
uwiger
2bf93d066d successful tests with inheritance
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@19 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 16:57:07 +00:00
uwiger
690309646a successful tests with inheritance
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@18 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 16:55:21 +00:00
uwiger
ee9e684b23 successful tests with inheritance
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@17 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 16:52:07 +00:00
uwiger
4ae20a8a84 successful tests with inheritance
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@16 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 16:51:01 +00:00
uwiger
18789e1a63 first wooper tests starting to work
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@15 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 15:29:09 +00:00
uwiger
992f572827 first wooper tests starting to work
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@14 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 15:27:51 +00:00
uwiger
971ad71f15 added #is_record-/2 generation to exprecs.erl
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@13 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 13:50:59 +00:00
uwiger
b5fd2940fa first commit of (unfinished) rewrite
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@12 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 12:27:05 +00:00
uwiger
f3706583fe first commit of (unfinished) rewrite
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@11 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 12:26:17 +00:00
uwiger
e7762e713c added exprecs.erl and wooper_parse_transform.erl
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@10 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-12-14 12:23:59 +00:00
uwiger
bd33333246 forgot to add new files
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@6 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-09-11 09:29:39 +00:00
uwiger
2b89a55e5b ported ct_expand, bug fixes
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@5 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-09-11 09:27:16 +00:00
uwiger
2fc581c60f added some comments
git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@3 ae7daa23-5771-0410-ae54-ec81a0701e84
2009-08-18 08:47:12 +00:00
uwiger
34926f300b git-svn-id: http://svn.ulf.wiger.net/parse_trans/trunk/parse_trans@1 ae7daa23-5771-0410-ae54-ec81a0701e84 2009-08-18 08:09:34 +00:00