diff options
author | David Robillard <d@drobilla.net> | 2010-04-13 02:28:56 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-04-13 02:28:56 +0000 |
commit | 8675beae4f7a8415fc2e88451da95dc068719194 (patch) | |
tree | 599de9b6730a14035a25f7d9e0467f96866185ed /test | |
parent | 1f988f420ba3827941886962680f3e2ad6f01740 (diff) | |
download | resp-8675beae4f7a8415fc2e88451da95dc068719194.tar.gz resp-8675beae4f7a8415fc2e88451da95dc068719194.tar.bz2 resp-8675beae4f7a8415fc2e88451da95dc068719194.zip |
Restructure as a source translation based compiler.
Implement support for closures (via lambda lifting phase).
git-svn-id: http://svn.drobilla.net/resp/resp@254 ad02d1e2-f140-0410-9f75-f8b11f17cedd
Diffstat (limited to 'test')
-rw-r--r-- | test/closure.resp | 5 | ||||
-rw-r--r-- | test/def.resp | 4 | ||||
-rw-r--r-- | test/deffn.resp | 3 | ||||
-rw-r--r-- | test/inlinefn.resp | 1 | ||||
-rw-r--r-- | test/nest.resp | 2 |
5 files changed, 12 insertions, 3 deletions
diff --git a/test/closure.resp b/test/closure.resp new file mode 100644 index 0000000..fb5a41d --- /dev/null +++ b/test/closure.resp @@ -0,0 +1,5 @@ +(def (multiplier factor) (fn (x) (* (+ x 0) factor))) + +(def doubler (multiplier 2)) + +(doubler 3) diff --git a/test/def.resp b/test/def.resp index dd9a0c8..52605b0 100644 --- a/test/def.resp +++ b/test/def.resp @@ -1,7 +1,7 @@ (def foo (fn (x) - (def y 2) - (def z 3) + (def y x) + (def z (+ x 1)) z)) (foo 3) diff --git a/test/deffn.resp b/test/deffn.resp new file mode 100644 index 0000000..c413ecd --- /dev/null +++ b/test/deffn.resp @@ -0,0 +1,3 @@ +(def f (fn (x) (+ x 1))) + +(f 2) diff --git a/test/inlinefn.resp b/test/inlinefn.resp new file mode 100644 index 0000000..2f055bd --- /dev/null +++ b/test/inlinefn.resp @@ -0,0 +1 @@ +((fn (x) (+ x 1)) 1) diff --git a/test/nest.resp b/test/nest.resp index 3085737..c15c453 100644 --- a/test/nest.resp +++ b/test/nest.resp @@ -1,6 +1,6 @@ (def (f x) (def (g y) (* y 2)) - (g x)) + (g (+ x 1))) (f 3) |