pure-lang-svn Mailing List for Pure (Page 34)
Status: Beta
Brought to you by:
agraef
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
(5) |
May
(141) |
Jun
(184) |
Jul
(97) |
Aug
(232) |
Sep
(196) |
Oct
|
Nov
|
Dec
|
---|
From: <ag...@us...> - 2008-05-03 10:05:37
|
Revision: 35 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=35&view=rev Author: agraef Date: 2008-05-03 03:05:43 -0700 (Sat, 03 May 2008) Log Message: ----------- Remove temporary workaround which hopefully isn't needed anymore. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/interpreter.hh Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-03 06:22:23 UTC (rev 34) +++ pure/trunk/interpreter.cc 2008-05-03 10:05:43 UTC (rev 35) @@ -735,7 +735,6 @@ f->dropAllReferences(); if (h != f) h->eraseFromParent(); f->eraseFromParent(); - reset(); } } @@ -2495,28 +2494,6 @@ return f; } -void interpreter::reset() -{ - /* XXXFIXME: Compile a trivial function to reprime the JIT. Apparently this - is needed to convince the JIT to pick up changes after clearing a - function definition. Don't ask, I don't understand it either. :( Maybe - it's a subtle bug somewhere in the code generator, but I found no other - way to work around it. If anyone knows why this is needed, or has a - better way to do it, please let me know. */ - expr x(EXPR::INT, 0); - Env e(0, 0, x, false); - push("reset", &e); - fun_prolog(""); - e.CreateRet(codegen(x)); - fun_finish(); - pop(&e); - e.fp = JIT->getPointerToFunction(e.f); - assert(e.fp); - pure_expr *y = 0, *res = pure_invoke(e.fp, y); - assert(res); pure_freenew(res); - e.f->eraseFromParent(); -} - pure_expr *interpreter::doeval(expr x, pure_expr*& e) { char test; Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-05-03 06:22:23 UTC (rev 34) +++ pure/trunk/interpreter.hh 2008-05-03 10:05:43 UTC (rev 35) @@ -402,7 +402,6 @@ Env *find_stacked(int32_t tag); Env& act_env() { assert(!envstk.empty()); return *envstk.front(); } Builder& act_builder() { return act_env().builder; } - void reset(); pure_expr *doeval(expr x, pure_expr*& e); pure_expr *dodefn(env vars, expr lhs, expr rhs, pure_expr*& e); llvm::Value *codegen(expr x); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-03 06:22:18
|
Revision: 34 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=34&view=rev Author: agraef Date: 2008-05-02 23:22:23 -0700 (Fri, 02 May 2008) Log Message: ----------- Disable tail call checks, as they may fail on some platforms. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/test/test4.log pure/trunk/test/test4.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-03 05:35:42 UTC (rev 33) +++ pure/trunk/ChangeLog 2008-05-03 06:22:23 UTC (rev 34) @@ -1,5 +1,8 @@ 2008-05-03 Albert Graef <Dr....@t-...> + * test/test4.pure: Disable tail call checks, as they may fail on + some platforms. Reported by Ryan Schmidt. + * test/test1.pure: Corrected fact3 example, added test cases. Reported by Libor Spacek. Modified: pure/trunk/test/test4.log =================================================================== --- pure/trunk/test/test4.log 2008-05-03 05:35:42 UTC (rev 33) +++ pure/trunk/test/test4.log 2008-05-03 06:22:23 UTC (rev 34) @@ -64,8 +64,6 @@ } count 100; 0 -count 10000000; -0 count2 n/*0:1*/::int = n/*0:1*/ if n/*0:1*/<=0; count2 n/*0:1*/::int = count2 (n/*0:1*/-1); { @@ -77,8 +75,6 @@ } count2 100; 0 -count2 10000000; -0 test x/*0:1*/::int = t/*0*/ x/*0:1*/ with t n/*0:1*/::int = t/*1*/ (-n/*0:1*/) if n/*0:1*/<0; t n/*0:1*/::int = u/*0*/ (n/*0:1*/+2) with u _/*0:1*/ = n/*1:1*/+1 { rule #0: u _ = n+1 state 0: #0 Modified: pure/trunk/test/test4.pure =================================================================== --- pure/trunk/test/test4.pure 2008-05-03 05:35:42 UTC (rev 33) +++ pure/trunk/test/test4.pure 2008-05-03 06:22:23 UTC (rev 34) @@ -28,7 +28,7 @@ count 100; // If proper tail calls are supported, this should work, too, no matter what // your stack size is. -count 10000000; +//count 10000000; // Tail recursion in a global function. @@ -37,8 +37,9 @@ // This should always work. count2 100; -// Again, this should work as well, no matter what your stack size is. -count2 10000000; +// Again, this should work if proper tail calls are supported, no matter what +// your stack size is. +//count2 10000000; // Trivial tail-recursive local function which passes an environment to // another local function. Note that the callee can never be tail-called in This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-03 05:35:34
|
Revision: 33 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=33&view=rev Author: agraef Date: 2008-05-02 22:35:42 -0700 (Fri, 02 May 2008) Log Message: ----------- Corrected regression test. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/test/test1.log pure/trunk/test/test1.pure Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-02 20:31:41 UTC (rev 32) +++ pure/trunk/ChangeLog 2008-05-03 05:35:42 UTC (rev 33) @@ -1,3 +1,8 @@ +2008-05-03 Albert Graef <Dr....@t-...> + + * test/test1.pure: Corrected fact3 example, added test cases. + Reported by Libor Spacek. + 2008-05-02 Albert Graef <Dr....@t-...> * Makefile: Overhaul of regression tests so that results of Modified: pure/trunk/test/test1.log =================================================================== --- pure/trunk/test/test1.log 2008-05-02 20:31:41 UTC (rev 32) +++ pure/trunk/test/test1.log 2008-05-03 05:35:42 UTC (rev 33) @@ -23,6 +23,8 @@ state 1: #0 } let x = fact1 10; +x; +3628800 fact2 n/*0:1*/ = case n/*0:1*/ of n/*0:*/ = n/*0:*/*fact2 (n/*0:*/-1) if n/*0:*/>0; n/*0:*/ = 1 { rule #0: n = n*fact2 (n-1) if n>0 rule #1: n = 1 @@ -30,9 +32,9 @@ <var> state 1 state 1: #0 #1 } end; -fact3 n/*0:1*/ = case n/*0:1*/ of 0 = 1; n/*0:*/ = n/*0:*/*fact3 (n/*0:*/-1) if n/*0:*/>1 { +fact3 n/*0:1*/ = case n/*0:1*/ of 0 = 1; n/*0:*/ = n/*0:*/*fact3 (n/*0:*/-1) if n/*0:*/>0 { rule #0: 0 = 1 - rule #1: n = n*fact3 (n-1) if n>1 + rule #1: n = n*fact3 (n-1) if n>0 state 0: #0 #1 <var> state 1 0::int state 2 @@ -46,9 +48,51 @@ <var> state 1 state 1: #0 }; +{ + rule #0: fact2 n = case n of n = n*fact2 (n-1) if n>0; n = 1 end + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: fact3 n = case n of 0 = 1; n = n*fact3 (n-1) if n>0 end + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: fact4 n = if n>0 then n*fact4 (n-1) else 1 + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: fact5 = \n -> if n>0 then n*fact5 (n-1) else 1 + state 0: #0 +} +fact2 10; +3628800 +fact3 10; +3628800 +fact4 10; +3628800 +fact5 10; +3628800 fact n/*0:1*/::int = fact (bigint n/*0:1*/); fact n/*0:1*/::bigint = n/*0:1*/*fact (n/*0:1*/-1) if n/*0:1*/>0; fact n/*0:1*/::bigint = 1; +{ + rule #0: fact n::int = fact (bigint n) + rule #1: fact n::bigint = n*fact (n-1) if n>0 + rule #2: fact n::bigint = 1 + state 0: #0 #1 #2 + <var>::int state 1 + <var>::bigint state 2 + state 1: #0 + state 2: #1 #2 +} +fact 50; +30414093201713378043612608166064768844377641568960512000000000000 fib1 0 = 0; fib1 1 = 1; fib1 n/*0:1*/ = fib1 (n/*0:1*/-2)+fib1 (n/*0:1*/-1) if n/*0:1*/>1; @@ -119,38 +163,6 @@ state 1: #0 #1 } end; { - rule #0: fact2 n = case n of n = n*fact2 (n-1) if n>0; n = 1 end - state 0: #0 - <var> state 1 - state 1: #0 -} -{ - rule #0: fact3 n = case n of 0 = 1; n = n*fact3 (n-1) if n>1 end - state 0: #0 - <var> state 1 - state 1: #0 -} -{ - rule #0: fact4 n = if n>0 then n*fact4 (n-1) else 1 - state 0: #0 - <var> state 1 - state 1: #0 -} -{ - rule #0: fact5 = \n -> if n>0 then n*fact5 (n-1) else 1 - state 0: #0 -} -{ - rule #0: fact n::int = fact (bigint n) - rule #1: fact n::bigint = n*fact (n-1) if n>0 - rule #2: fact n::bigint = 1 - state 0: #0 #1 #2 - <var>::int state 1 - <var>::bigint state 2 - state 1: #0 - state 2: #1 #2 -} -{ rule #0: fib1 0 = 0 rule #1: fib1 1 = 1 rule #2: fib1 n = fib1 (n-2)+fib1 (n-1) if n>1 Modified: pure/trunk/test/test1.pure =================================================================== --- pure/trunk/test/test1.pure 2008-05-02 20:31:41 UTC (rev 32) +++ pure/trunk/test/test1.pure 2008-05-03 05:35:42 UTC (rev 33) @@ -14,7 +14,7 @@ fact1 n = n*fact1 (n-1) if n>0; = 1 otherwise; -let x = fact1 10; +let x = fact1 10; x; // Factorial, using case. @@ -27,7 +27,7 @@ fact3 n = case n of 0 = 1; - n = n*fact3 (n-1) if n>1; + n = n*fact3 (n-1) if n>0; end; // Factorial, with if-then-else. @@ -38,12 +38,19 @@ fact5 = \n -> if n>0 then n*fact5 (n-1) else 1; +fact2 10; +fact3 10; +fact4 10; +fact5 10; + // Factorial, using bigints. fact n::int = fact (bigint n); fact n::bigint = n*fact (n-1) if n>0; = 1 otherwise; +fact 50; + // Fibonacci function, naive O(fib n) implementation. fib1 0 = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 20:31:35
|
Revision: 32 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=32&view=rev Author: agraef Date: 2008-05-02 13:31:41 -0700 (Fri, 02 May 2008) Log Message: ----------- Overhaul of regression test goals. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/Makefile Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-02 20:30:47 UTC (rev 31) +++ pure/trunk/ChangeLog 2008-05-02 20:31:41 UTC (rev 32) @@ -1,5 +1,11 @@ 2008-05-02 Albert Graef <Dr....@t-...> + * Makefile: Overhaul of regression tests so that results of + expressions are recorded. Also, 'make check' doesn't depend on the + log files any more, so that the logs can be stored in svn. You can + now use the explicit goal 'make logs' to regenerate the logs for + changed test files. + * runtime.cc (same): Added a syntactic equality test. Requested by Eddie Rucker. Modified: pure/trunk/Makefile =================================================================== --- pure/trunk/Makefile 2008-05-02 20:30:47 UTC (rev 31) +++ pure/trunk/Makefile 2008-05-02 20:31:41 UTC (rev 32) @@ -168,16 +168,16 @@ logs: $(logs) -check: pure $(logs) +check: pure @ echo Running tests. @ (export PURELIB=./lib; echo -n "prelude.pure: "; if ./pure -n -v$(level) lib/prelude.pure | diff -q - test/prelude.log > /dev/null; then echo passed; else echo FAILED; fi) - @ (cd test; export PURELIB=../lib; for x in $(tests); do f="`basename $$x`"; l="`basename $$x .pure`.log"; echo -n "$$x: "; if ../pure -v$(level) $$f | diff -q - $$l > /dev/null; then echo passed; else echo FAILED; fi; done) + @ (cd test; export PURELIB=../lib; for x in $(tests); do f="`basename $$x`"; l="`basename $$x .pure`.log"; echo -n "$$x: "; if ../pure -v$(level) < $$f | diff -q - $$l > /dev/null; then echo passed; else echo FAILED; fi; done) test/prelude.log: lib/prelude.pure PURELIB=./lib ./pure -n -v$(level) $< > $@ %.log: %.pure - PURELIB=./lib ./pure -v$(level) $< > $@ + PURELIB=./lib ./pure -v$(level) < $< > $@ # DO NOT DELETE This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 20:30:42
|
Revision: 31 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=31&view=rev Author: agraef Date: 2008-05-02 13:30:47 -0700 (Fri, 02 May 2008) Log Message: ----------- Added test log files. Added Paths: ----------- pure/trunk/test/prelude.log pure/trunk/test/test1.log pure/trunk/test/test2.log pure/trunk/test/test3.log pure/trunk/test/test4.log pure/trunk/test/test5.log pure/trunk/test/test6.log pure/trunk/test/test7.log Added: pure/trunk/test/prelude.log =================================================================== --- pure/trunk/test/prelude.log (rev 0) +++ pure/trunk/test/prelude.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,650 @@ +throw x/*0:1*/ = pure_throw x/*0:1*/; +x/*0:01*/===y/*0:1*/ = same x/*0:01*/ y/*0:1*/; +x/*0:01*/!==y/*0:1*/ = not same x/*0:01*/ y/*0:1*/; +intp x/*0:1*/ = case x/*0:1*/ of _/*0:*/::int = 1; _/*0:*/ = 0 { + rule #0: _::int = 1 + rule #1: _ = 0 + state 0: #0 #1 + <var> state 1 + <var>::int state 2 + state 1: #1 + state 2: #0 #1 +} end; +bigintp x/*0:1*/ = case x/*0:1*/ of _/*0:*/::bigint = 1; _/*0:*/ = 0 { + rule #0: _::bigint = 1 + rule #1: _ = 0 + state 0: #0 #1 + <var> state 1 + <var>::bigint state 2 + state 1: #1 + state 2: #0 #1 +} end; +doublep x/*0:1*/ = case x/*0:1*/ of _/*0:*/::double = 1; _/*0:*/ = 0 { + rule #0: _::double = 1 + rule #1: _ = 0 + state 0: #0 #1 + <var> state 1 + <var>::double state 2 + state 1: #1 + state 2: #0 #1 +} end; +stringp x/*0:1*/ = case x/*0:1*/ of _/*0:*/::string = 1; _/*0:*/ = 0 { + rule #0: _::string = 1 + rule #1: _ = 0 + state 0: #0 #1 + <var> state 1 + <var>::string state 2 + state 1: #1 + state 2: #0 #1 +} end; +pointerp x/*0:1*/ = case x/*0:1*/ of _/*0:*/ = 1; _/*0:*/ = 0 { + rule #0: _ = 1 + rule #1: _ = 0 + state 0: #0 #1 + <var> state 1 + <var> state 2 + state 1: #1 + state 2: #0 #1 +} end; +listp [] = 1; +listp (x/*0:101*/:xs/*0:11*/) = listp xs/*0:11*/; +listp _/*0:1*/ = 0; +tuplep () = 1; +tuplep (x/*0:101*/,xs/*0:11*/) = 1; +tuplep _/*0:1*/ = 0; +int x/*0:1*/::int = x/*0:1*/; +int x/*0:1*/::bigint = pure_intval x/*0:1*/; +int x/*0:1*/::double = pure_intval x/*0:1*/; +int x/*0:1*/ = pure_intval x/*0:1*/; +bigint x/*0:1*/::int = pure_bigintval x/*0:1*/; +bigint x/*0:1*/::bigint = x/*0:1*/; +bigint x/*0:1*/::double = pure_bigintval x/*0:1*/; +bigint x/*0:1*/ = pure_bigintval x/*0:1*/; +double x/*0:1*/::int = pure_dblval x/*0:1*/; +double x/*0:1*/::bigint = pure_dblval x/*0:1*/; +double x/*0:1*/::double = x/*0:1*/; +pointer x/*0:1*/::int = pure_pointerval x/*0:1*/; +pointer x/*0:1*/::bigint = pure_pointerval x/*0:1*/; +pointer x/*0:1*/::double = pure_pointerval x/*0:1*/; +pointer x/*0:1*/::string = pure_pointerval x/*0:1*/; +pointer x/*0:1*/ = x/*0:1*/; +-x/*0:1*/::int = -x/*0:1*/; +~x/*0:1*/::int = ~x/*0:1*/; +not x/*0:1*/::int = not x/*0:1*/; +x/*0:01*/::int<<y/*0:1*/::int = x/*0:01*/<<y/*0:1*/; +x/*0:01*/::int>>y/*0:1*/::int = x/*0:01*/>>y/*0:1*/; +x/*0:01*/::int+y/*0:1*/::int = x/*0:01*/+y/*0:1*/; +x/*0:01*/::int-y/*0:1*/::int = x/*0:01*/-y/*0:1*/; +x/*0:01*/::int|y/*0:1*/::int = x/*0:01*/|y/*0:1*/; +x/*0:01*/::int*y/*0:1*/::int = x/*0:01*/*y/*0:1*/; +x/*0:01*/::int/y/*0:1*/::int = x/*0:01*//y/*0:1*/; +x/*0:01*/::int&y/*0:1*/::int = x/*0:01*/&y/*0:1*/; +x/*0:01*/::int div y/*0:1*/::int = x/*0:01*/ div y/*0:1*/; +x/*0:01*/::int mod y/*0:1*/::int = x/*0:01*/ mod y/*0:1*/; +x/*0:01*/::int<y/*0:1*/::int = x/*0:01*/<y/*0:1*/; +x/*0:01*/::int>y/*0:1*/::int = x/*0:01*/>y/*0:1*/; +x/*0:01*/::int<=y/*0:1*/::int = x/*0:01*/<=y/*0:1*/; +x/*0:01*/::int>=y/*0:1*/::int = x/*0:01*/>=y/*0:1*/; +x/*0:01*/::int==y/*0:1*/::int = x/*0:01*/==y/*0:1*/; +x/*0:01*/::int!=y/*0:1*/::int = x/*0:01*/!=y/*0:1*/; +-x/*0:1*/::double = -x/*0:1*/; +x/*0:01*/::double+y/*0:1*/::double = x/*0:01*/+y/*0:1*/; +x/*0:01*/::double-y/*0:1*/::double = x/*0:01*/-y/*0:1*/; +x/*0:01*/::double*y/*0:1*/::double = x/*0:01*/*y/*0:1*/; +x/*0:01*/::double/y/*0:1*/::double = x/*0:01*//y/*0:1*/; +x/*0:01*/::double<y/*0:1*/::double = x/*0:01*/<y/*0:1*/; +x/*0:01*/::double>y/*0:1*/::double = x/*0:01*/>y/*0:1*/; +x/*0:01*/::double<=y/*0:1*/::double = x/*0:01*/<=y/*0:1*/; +x/*0:01*/::double>=y/*0:1*/::double = x/*0:01*/>=y/*0:1*/; +x/*0:01*/::double==y/*0:1*/::double = x/*0:01*/==y/*0:1*/; +x/*0:01*/::double!=y/*0:1*/::double = x/*0:01*/!=y/*0:1*/; +x/*0:01*/::int+y/*0:1*/::double = x/*0:01*/+y/*0:1*/; +x/*0:01*/::int-y/*0:1*/::double = x/*0:01*/-y/*0:1*/; +x/*0:01*/::int*y/*0:1*/::double = x/*0:01*/*y/*0:1*/; +x/*0:01*/::int/y/*0:1*/::double = x/*0:01*//y/*0:1*/; +x/*0:01*/::int<y/*0:1*/::double = x/*0:01*/<y/*0:1*/; +x/*0:01*/::int>y/*0:1*/::double = x/*0:01*/>y/*0:1*/; +x/*0:01*/::int<=y/*0:1*/::double = x/*0:01*/<=y/*0:1*/; +x/*0:01*/::int>=y/*0:1*/::double = x/*0:01*/>=y/*0:1*/; +x/*0:01*/::int==y/*0:1*/::double = x/*0:01*/==y/*0:1*/; +x/*0:01*/::int!=y/*0:1*/::double = x/*0:01*/!=y/*0:1*/; +x/*0:01*/::double+y/*0:1*/::int = x/*0:01*/+y/*0:1*/; +x/*0:01*/::double-y/*0:1*/::int = x/*0:01*/-y/*0:1*/; +x/*0:01*/::double*y/*0:1*/::int = x/*0:01*/*y/*0:1*/; +x/*0:01*/::double/y/*0:1*/::int = x/*0:01*//y/*0:1*/; +x/*0:01*/::double<y/*0:1*/::int = x/*0:01*/<y/*0:1*/; +x/*0:01*/::double>y/*0:1*/::int = x/*0:01*/>y/*0:1*/; +x/*0:01*/::double<=y/*0:1*/::int = x/*0:01*/<=y/*0:1*/; +x/*0:01*/::double>=y/*0:1*/::int = x/*0:01*/>=y/*0:1*/; +x/*0:01*/::double==y/*0:1*/::int = x/*0:01*/==y/*0:1*/; +x/*0:01*/::double!=y/*0:1*/::int = x/*0:01*/!=y/*0:1*/; +x/*0:01*/::int&&y/*0:1*/::int = x/*0:01*/&&y/*0:1*/; +x/*0:01*/::int||y/*0:1*/::int = x/*0:01*/||y/*0:1*/; +-x/*0:1*/::bigint = bigint_neg x/*0:1*/; +~x/*0:1*/::bigint = bigint_not x/*0:1*/; +not x/*0:1*/::bigint = not int x/*0:1*/; +x/*0:01*/::bigint<<y/*0:1*/::int = bigint_shl x/*0:01*/ y/*0:1*/ if y/*0:1*/>=0; +x/*0:01*/::bigint<<y/*0:1*/::int = bigint_shr x/*0:01*/ (-y/*0:1*/); +x/*0:01*/::bigint>>y/*0:1*/::int = bigint_shr x/*0:01*/ y/*0:1*/ if y/*0:1*/>=0; +x/*0:01*/::bigint>>y/*0:1*/::int = bigint_shl x/*0:01*/ (-y/*0:1*/); +x/*0:01*/::bigint+y/*0:1*/::bigint = bigint_add x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint-y/*0:1*/::bigint = bigint_sub x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint|y/*0:1*/::bigint = bigint_or x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint*y/*0:1*/::bigint = bigint_mul x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint/y/*0:1*/::bigint = double x/*0:01*//double y/*0:1*/; +x/*0:01*/::bigint&y/*0:1*/::bigint = bigint_and x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint div y/*0:1*/::bigint = bigint_div x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint mod y/*0:1*/::bigint = bigint_mod x/*0:01*/ y/*0:1*/; +x/*0:01*/::bigint<y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/<0; +x/*0:01*/::bigint>y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/>0; +x/*0:01*/::bigint<=y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/<=0; +x/*0:01*/::bigint>=y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/>=0; +x/*0:01*/::bigint==y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/==0; +x/*0:01*/::bigint!=y/*0:1*/::bigint = bigint_cmp x/*0:01*/ y/*0:1*/!=0; +x/*0:01*/::int+y/*0:1*/::bigint = bigint x/*0:01*/+y/*0:1*/; +x/*0:01*/::int-y/*0:1*/::bigint = bigint x/*0:01*/-y/*0:1*/; +x/*0:01*/::int|y/*0:1*/::bigint = bigint x/*0:01*/|y/*0:1*/; +x/*0:01*/::int*y/*0:1*/::bigint = bigint x/*0:01*/*y/*0:1*/; +x/*0:01*/::int/y/*0:1*/::bigint = double x/*0:01*//y/*0:1*/; +x/*0:01*/::int&y/*0:1*/::bigint = bigint x/*0:01*/&y/*0:1*/; +x/*0:01*/::int div y/*0:1*/::bigint = bigint x/*0:01*/ div y/*0:1*/; +x/*0:01*/::int mod y/*0:1*/::bigint = bigint x/*0:01*/ mod y/*0:1*/; +x/*0:01*/::int<y/*0:1*/::bigint = bigint x/*0:01*/<y/*0:1*/; +x/*0:01*/::int>y/*0:1*/::bigint = bigint x/*0:01*/>y/*0:1*/; +x/*0:01*/::int<=y/*0:1*/::bigint = bigint x/*0:01*/<=y/*0:1*/; +x/*0:01*/::int>=y/*0:1*/::bigint = bigint x/*0:01*/>=y/*0:1*/; +x/*0:01*/::int==y/*0:1*/::bigint = bigint x/*0:01*/==y/*0:1*/; +x/*0:01*/::int!=y/*0:1*/::bigint = bigint x/*0:01*/!=y/*0:1*/; +x/*0:01*/::bigint+y/*0:1*/::int = x/*0:01*/+bigint y/*0:1*/; +x/*0:01*/::bigint-y/*0:1*/::int = x/*0:01*/-bigint y/*0:1*/; +x/*0:01*/::bigint|y/*0:1*/::int = x/*0:01*/|bigint y/*0:1*/; +x/*0:01*/::bigint*y/*0:1*/::int = x/*0:01*/*bigint y/*0:1*/; +x/*0:01*/::bigint/y/*0:1*/::int = x/*0:01*//double y/*0:1*/; +x/*0:01*/::bigint&y/*0:1*/::int = x/*0:01*/&bigint y/*0:1*/; +x/*0:01*/::bigint div y/*0:1*/::int = x/*0:01*/ div bigint y/*0:1*/; +x/*0:01*/::bigint mod y/*0:1*/::int = x/*0:01*/ mod bigint y/*0:1*/; +x/*0:01*/::bigint<y/*0:1*/::int = x/*0:01*/<bigint y/*0:1*/; +x/*0:01*/::bigint>y/*0:1*/::int = x/*0:01*/>bigint y/*0:1*/; +x/*0:01*/::bigint<=y/*0:1*/::int = x/*0:01*/<=bigint y/*0:1*/; +x/*0:01*/::bigint>=y/*0:1*/::int = x/*0:01*/>=bigint y/*0:1*/; +x/*0:01*/::bigint==y/*0:1*/::int = x/*0:01*/==bigint y/*0:1*/; +x/*0:01*/::bigint!=y/*0:1*/::int = x/*0:01*/!=bigint y/*0:1*/; +x/*0:01*/::bigint+y/*0:1*/::double = double x/*0:01*/+y/*0:1*/; +x/*0:01*/::bigint-y/*0:1*/::double = double x/*0:01*/-y/*0:1*/; +x/*0:01*/::bigint*y/*0:1*/::double = double x/*0:01*/*y/*0:1*/; +x/*0:01*/::bigint/y/*0:1*/::double = double x/*0:01*//y/*0:1*/; +x/*0:01*/::bigint<y/*0:1*/::double = double x/*0:01*/<y/*0:1*/; +x/*0:01*/::bigint>y/*0:1*/::double = double x/*0:01*/>y/*0:1*/; +x/*0:01*/::bigint<=y/*0:1*/::double = double x/*0:01*/<=y/*0:1*/; +x/*0:01*/::bigint>=y/*0:1*/::double = double x/*0:01*/>=y/*0:1*/; +x/*0:01*/::bigint==y/*0:1*/::double = double x/*0:01*/==y/*0:1*/; +x/*0:01*/::bigint!=y/*0:1*/::double = double x/*0:01*/!=y/*0:1*/; +x/*0:01*/::double+y/*0:1*/::bigint = x/*0:01*/+double y/*0:1*/; +x/*0:01*/::double-y/*0:1*/::bigint = x/*0:01*/-double y/*0:1*/; +x/*0:01*/::double*y/*0:1*/::bigint = x/*0:01*/*double y/*0:1*/; +x/*0:01*/::double/y/*0:1*/::bigint = x/*0:01*//double y/*0:1*/; +x/*0:01*/::double<y/*0:1*/::bigint = x/*0:01*/<double y/*0:1*/; +x/*0:01*/::double>y/*0:1*/::bigint = x/*0:01*/>double y/*0:1*/; +x/*0:01*/::double<=y/*0:1*/::bigint = x/*0:01*/<=double y/*0:1*/; +x/*0:01*/::double>=y/*0:1*/::bigint = x/*0:01*/>=double y/*0:1*/; +x/*0:01*/::double==y/*0:1*/::bigint = x/*0:01*/==double y/*0:1*/; +x/*0:01*/::double!=y/*0:1*/::bigint = x/*0:01*/!=double y/*0:1*/; +pow x/*0:01*/::bigint y/*0:1*/::int = bigint_pow x/*0:01*/ y/*0:1*/ if y/*0:1*/>=0; +pow x/*0:01*/::int y/*0:1*/::int = bigint_pow (bigint x/*0:01*/) y/*0:1*/ if y/*0:1*/>=0; +pow x/*0:01*/::bigint y/*0:1*/::bigint = bigint_pow x/*0:01*/ (int y/*0:1*/) if int y/*0:1*/>=0; +null x/*0:1*/ = bigint x/*0:1*/==0; +x/*0:01*/-y/*0:1*/ = bigint x/*0:01*/-bigint y/*0:1*/; +x/*0:01*/+y/*0:1*/::int = pointer (bigint x/*0:01*/+y/*0:1*/); +x/*0:01*/+y/*0:1*/::bigint = pointer (bigint x/*0:01*/+y/*0:1*/); +x/*0:01*/<y/*0:1*/ = bigint x/*0:01*/<bigint y/*0:1*/; +x/*0:01*/>y/*0:1*/ = bigint x/*0:01*/>bigint y/*0:1*/; +x/*0:01*/<=y/*0:1*/ = bigint x/*0:01*/<=bigint y/*0:1*/; +x/*0:01*/>=y/*0:1*/ = bigint x/*0:01*/>=bigint y/*0:1*/; +x/*0:01*/==y/*0:1*/ = bigint x/*0:01*/==bigint y/*0:1*/; +x/*0:01*/!=y/*0:1*/ = bigint x/*0:01*/!=bigint y/*0:1*/; +get_byte x/*0:1*/ = pointer_get_byte x/*0:1*/; +get_int x/*0:1*/ = pointer_get_int x/*0:1*/; +get_double x/*0:1*/ = pointer_get_double x/*0:1*/; +get_string x/*0:1*/ = pointer_get_string x/*0:1*/; +get_pointer x/*0:1*/ = pointer_get_pointer x/*0:1*/; +put_byte x/*0:01*/ y/*0:1*/::int = pointer_put_byte x/*0:01*/ y/*0:1*/; +put_int x/*0:01*/ y/*0:1*/::int = pointer_put_int x/*0:01*/ y/*0:1*/; +put_double x/*0:01*/ y/*0:1*/::double = pointer_put_double x/*0:01*/ y/*0:1*/; +put_string x/*0:01*/ y/*0:1*/::string = pointer_put_string x/*0:01*/ y/*0:1*/; +put_pointer x/*0:01*/ y/*0:1*/::string = pointer_put_pointer x/*0:01*/ y/*0:1*/; +put_pointer x/*0:01*/ y/*0:1*/ = pointer_put_pointer x/*0:01*/ y/*0:1*/; +chr n/*0:1*/::int = string_chr n/*0:1*/ if n/*0:1*/>0; +ord s/*0:1*/::string = string_ord s/*0:1*/ if #s/*0:1*/==1; +string s/*0:1*/ = pure_string s/*0:1*/; +cstring s/*0:1*/ = pure_cstring s/*0:1*/; +string_dup s/*0:1*/ = pure_string_dup s/*0:1*/; +cstring_dup s/*0:1*/ = pure_cstring_dup s/*0:1*/; +byte_string s/*0:1*/::string = pure_byte_string s/*0:1*/; +byte_cstring s/*0:1*/::string = pure_byte_cstring s/*0:1*/; +c/*0:01*/::string+n/*0:1*/::int = chr (ord c/*0:01*/+n/*0:1*/) if #c/*0:01*/==1; +c/*0:01*/::string-n/*0:1*/::int = chr (ord c/*0:01*/-n/*0:1*/) if #c/*0:01*/==1&&ord c/*0:01*/>=n/*0:1*/; +c/*0:01*/::string-d/*0:1*/::string = ord c/*0:01*/-ord d/*0:1*/ if #c/*0:01*/==1&&#d/*0:1*/==1; +null s/*0:1*/::string = string_null s/*0:1*/; +#s/*0:1*/::string = string_size s/*0:1*/; +s/*0:01*/::string!n/*0:1*/::int = string_char_at s/*0:01*/ n/*0:1*/ if n/*0:1*/>=0&&n/*0:1*/<#s/*0:01*/; +s/*0:01*/::string+t/*0:1*/::string = string_concat s/*0:01*/ t/*0:1*/; +chars s/*0:1*/::string = string_chars s/*0:1*/; +x/*0:01*/::string<y/*0:1*/::string = strcmp x/*0:01*/ y/*0:1*/<0; +x/*0:01*/::string>y/*0:1*/::string = strcmp x/*0:01*/ y/*0:1*/>0; +x/*0:01*/::string<=y/*0:1*/::string = strcmp x/*0:01*/ y/*0:1*/<=0; +x/*0:01*/::string>=y/*0:1*/::string = strcmp x/*0:01*/ y/*0:1*/>=0; +x/*0:01*/::string==y/*0:1*/::string = strcmp x/*0:01*/ y/*0:1*/==0; +x/*0:01*/::string!=y/*0:1*/::string = strcmp x/*0:01*/ y/*0:1*/!=0; +substr s/*0:001*/::string pos/*0:01*/::int size/*0:1*/::int = string_substr s/*0:001*/ (max/*0*/ 0 pos/*0:01*/) (max/*0*/ 0 size/*0:1*/) with max x/*0:01*/ y/*0:1*/ = if x/*0:01*/>=y/*0:1*/ then x/*0:01*/ else y/*0:1*/ { + rule #0: max x y = if x>=y then x else y + state 0: #0 + <var> state 1 + state 1: #0 + <var> state 2 + state 2: #0 +} end; +index s/*0:01*/::string u/*0:1*/::string = string_index s/*0:01*/ u/*0:1*/; +strcat xs/*0:1*/ = string_concat_list xs/*0:1*/ if listp xs/*0:1*/&&all stringp xs/*0:1*/; +join delim/*0:01*/::string [] = ""; +join delim/*0:01*/::string (x/*0:101*/::string:xs/*0:11*/) = x/*0:101*/+strcat (catmap (\x/*0:*/ -> [delim/*1:01*/+x/*0:*/] { + rule #0: x = [delim+x] + state 0: #0 + <var> state 1 + state 1: #0 +}) xs/*0:11*/) if listp xs/*0:11*/&&all stringp xs/*0:11*/; +split delim/*0:01*/::string s/*0:1*/::string = if null s/*1:1*/ then [] else split1/*0*/ delim/*1:01*/ s/*1:1*/ with split1 delim/*0:01*/ s/*0:1*/ = case index s/*0:1*/ delim/*0:01*/ of n/*0:*/ = take n/*0:*/ s/*1:1*/:split1/*2*/ delim/*1:01*/ (drop (n/*0:*/+m/*2:*/) s/*1:1*/) if n/*0:*/>=0; n/*0:*/ = [s/*1:1*/] { + rule #0: n = take n s:split1 delim (drop (n+m) s) if n>=0 + rule #1: n = [s] + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 +} end { + rule #0: split1 delim s = case index s delim of n = take n s:split1 delim (drop (n+m) s) if n>=0; n = [s] end + state 0: #0 + <var> state 1 + state 1: #0 + <var> state 2 + state 2: #0 +} end when m/*0:*/ = #delim/*0:01*/ { + rule #0: m = #delim + state 0: #0 + <var> state 1 + state 1: #0 +} end if not null delim/*0:01*/; +reverse s/*0:1*/::string = strcat (reverse (chars s/*0:1*/)); +cat (s/*0:101*/::string:xs/*0:11*/) = cat (chars s/*0:101*/:xs/*0:11*/); +all p/*0:01*/ s/*0:1*/::string = all p/*0:01*/ (chars s/*0:1*/); +any p/*0:01*/ s/*0:1*/::string = any p/*0:01*/ (chars s/*0:1*/); +do f/*0:01*/ s/*0:1*/::string = do f/*0:01*/ (chars s/*0:1*/); +drop n/*0:01*/ s/*0:1*/::string = substr s/*0:1*/ n/*0:01*/ (#s/*0:1*/-n/*0:01*/); +dropwhile p/*0:01*/ s/*0:1*/::string = strcat (dropwhile p/*0:01*/ (chars s/*0:1*/)); +filter p/*0:01*/ s/*0:1*/::string = strcat (filter p/*0:01*/ (chars s/*0:1*/)); +foldl f/*0:001*/ a/*0:01*/ s/*0:1*/::string = foldl f/*0:001*/ a/*0:01*/ (chars s/*0:1*/); +foldl1 f/*0:01*/ s/*0:1*/::string = foldl1 f/*0:01*/ (chars s/*0:1*/); +foldr f/*0:001*/ a/*0:01*/ s/*0:1*/::string = foldr f/*0:001*/ a/*0:01*/ (chars s/*0:1*/); +foldr1 f/*0:01*/ s/*0:1*/::string = foldr1 f/*0:01*/ (chars s/*0:1*/); +head s/*0:1*/::string = s/*0:1*/!0 if not null s/*0:1*/; +init s/*0:1*/::string = substr s/*0:1*/ 0 (#s/*0:1*/-1) if not null s/*0:1*/; +last s/*0:1*/::string = s/*0:1*/!(#s/*0:1*/-1) if not null s/*0:1*/; +map f/*0:01*/ s/*0:1*/::string = map f/*0:01*/ (chars s/*0:1*/); +scanl f/*0:001*/ a/*0:01*/ s/*0:1*/::string = scanl f/*0:001*/ a/*0:01*/ (chars s/*0:1*/); +scanl1 f/*0:01*/ s/*0:1*/::string = scanl1 f/*0:01*/ (chars s/*0:1*/); +scanr f/*0:001*/ a/*0:01*/ s/*0:1*/::string = scanr f/*0:001*/ a/*0:01*/ (chars s/*0:1*/); +scanr1 f/*0:01*/ s/*0:1*/::string = scanr1 f/*0:01*/ (chars s/*0:1*/); +take n/*0:01*/ s/*0:1*/::string = substr s/*0:1*/ 0 n/*0:01*/; +takewhile p/*0:01*/ s/*0:1*/::string = strcat (takewhile p/*0:01*/ (chars s/*0:1*/)); +tail s/*0:1*/::string = substr s/*0:1*/ 1 (#s/*0:1*/-1) if not null s/*0:1*/; +zip s/*0:01*/::string t/*0:1*/::string = zip (chars s/*0:01*/) (chars t/*0:1*/); +zip3 s/*0:001*/::string t/*0:01*/::string u/*0:1*/::string = zip3 (chars s/*0:001*/) (chars t/*0:01*/) (chars u/*0:1*/); +zipwith f/*0:001*/ s/*0:01*/::string t/*0:1*/::string = zipwith f/*0:001*/ (chars s/*0:01*/) (chars t/*0:1*/); +zipwith3 f/*0:0001*/ s/*0:001*/::string t/*0:01*/::string u/*0:1*/::string = zipwith3 f/*0:0001*/ (chars s/*0:001*/) (chars t/*0:01*/) (chars u/*0:1*/); +dowith f/*0:001*/ s/*0:01*/::string t/*0:1*/::string = dowith f/*0:001*/ (chars s/*0:01*/) (chars t/*0:1*/); +dowith3 f/*0:0001*/ s/*0:001*/::string t/*0:01*/::string u/*0:1*/::string = dowith3 f/*0:0001*/ (chars s/*0:001*/) (chars t/*0:01*/) (chars u/*0:1*/); +f/*0:01*/$x/*0:1*/ = f/*0:01*/ x/*0:1*/; +(f/*0:001*/.g/*0:01*/) x/*0:1*/ = f/*0:001*/ (g/*0:01*/ x/*0:1*/); +void _/*0:1*/ = (); +id x/*0:1*/ = x/*0:1*/; +const x/*0:01*/ y/*0:1*/ = x/*0:01*/; +flip f/*0:001*/ x/*0:01*/ y/*0:1*/ = f/*0:001*/ y/*0:1*/ x/*0:01*/; +curry f/*0:001*/ x/*0:01*/ y/*0:1*/ = f/*0:001*/ (x/*0:01*/,y/*0:1*/); +curry3 f/*0:0001*/ x/*0:001*/ y/*0:01*/ z/*0:1*/ = f/*0:0001*/ (x/*0:001*/,y/*0:01*/,z/*0:1*/); +uncurry f/*0:01*/ (x/*0:101*/,y/*0:11*/) = f/*0:01*/ x/*0:101*/ y/*0:11*/; +uncurry3 f/*0:01*/ (x/*0:101*/,y/*0:1101*/,z/*0:111*/) = f/*0:01*/ x/*0:101*/ y/*0:1101*/ z/*0:111*/; +x/*0:01*/,() = x/*0:01*/; +(),y/*0:1*/ = y/*0:1*/; +(x/*0:0101*/,y/*0:011*/),z/*0:1*/ = x/*0:0101*/,y/*0:011*/,z/*0:1*/; +()==() = 1; +(x/*0:0101*/,xs/*0:011*/)==() = 0; +()==(x/*0:101*/,xs/*0:11*/) = 0; +(x/*0:0101*/,xs/*0:011*/)==(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; +()!=() = 0; +(x/*0:0101*/,xs/*0:011*/)!=() = 1; +()!=(x/*0:101*/,xs/*0:11*/) = 1; +(x/*0:0101*/,xs/*0:011*/)!=(y/*0:101*/,ys/*0:11*/) = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; +null () = 1; +null (x/*0:101*/,xs/*0:11*/) = 0; +#() = 0; +#(x/*0:101*/,y/*0:1101*/,xs/*0:111*/) = 1+#(y/*0:1101*/,xs/*0:111*/); +#(x/*0:101*/,y/*0:11*/) = 2; +(x/*0:0101*/,xs/*0:011*/)!0 = x/*0:0101*/; +(x/*0:0101*/,y/*0:01101*/,xs/*0:0111*/)!n/*0:1*/::int = (y/*0:01101*/,xs/*0:0111*/)!(n/*0:1*/-1) if n/*0:1*/>0; +(x/*0:0101*/,y/*0:011*/)!1 = y/*0:011*/; +[]==[] = 1; +x/*0:0101*/:xs/*0:011*/==[] = 0; +[]==x/*0:101*/:xs/*0:11*/ = 0; +x/*0:0101*/:xs/*0:011*/==y/*0:101*/:ys/*0:11*/ = x/*0:0101*/==y/*0:101*/&&xs/*0:011*/==ys/*0:11*/; +[]!=[] = 0; +x/*0:0101*/:xs/*0:011*/!=[] = 1; +[]!=x/*0:101*/:xs/*0:11*/ = 1; +x/*0:0101*/:xs/*0:011*/!=y/*0:101*/:ys/*0:11*/ = x/*0:0101*/!=y/*0:101*/||xs/*0:011*/!=ys/*0:11*/; +null [] = 1; +null (x/*0:101*/:xs/*0:11*/) = 0; +#[] = 0; +#(x/*0:101*/:xs/*0:11*/) = 1+#xs/*0:11*/; +(x/*0:0101*/:xs/*0:011*/)!0 = x/*0:0101*/; +(x/*0:0101*/:xs/*0:011*/)!n/*0:1*/::int = xs/*0:011*/!(n/*0:1*/-1) if n/*0:1*/>0; +[]+ys/*0:1*/ = ys/*0:1*/; +(x/*0:0101*/:xs/*0:011*/)+ys/*0:1*/ = x/*0:0101*/:xs/*0:011*/+ys/*0:1*/; +list () = []; +list (x/*0:101*/,y/*0:1101*/,xs/*0:111*/) = x/*0:101*/:list (y/*0:1101*/,xs/*0:111*/); +list (x/*0:101*/,y/*0:11*/) = [x/*0:101*/,y/*0:11*/]; +tuple [] = (); +tuple [x/*0:101*/] = x/*0:101*/; +tuple (x/*0:101*/:y/*0:1101*/:xs/*0:111*/) = x/*0:101*/,tuple (y/*0:1101*/:xs/*0:111*/); +xs/*0:01*/![] = []; +xs/*0:01*/!(n/*0:101*/::int:ns/*0:11*/) = slice/*0*/ xs/*1:01*/ (n/*1:101*/:ns/*1:11*/) with slice xs/*0:01*/ [] = []; slice xs/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = xs/*0:01*/!n/*0:101*/:slice/*1*/ xs/*0:01*/ ns/*0:11*/ if n/*0:101*/>=0&&n/*0:101*/<m/*1:*/; slice xs/*0:01*/ (n/*0:101*/::int:ns/*0:11*/) = xs/*0:01*/!ns/*0:11*/ { + rule #0: slice xs [] = [] + rule #1: slice xs (n::int:ns) = xs!n:slice xs ns if n>=0&&n<m + rule #2: slice xs (n::int:ns) = xs!ns + state 0: #0 #1 #2 + <var> state 1 + state 1: #0 #1 #2 + [] state 2 + <app> state 3 + state 2: #0 + state 3: #1 #2 + <app> state 4 + state 4: #1 #2 + : state 5 + state 5: #1 #2 + <var>::int state 6 + state 6: #1 #2 + <var> state 7 + state 7: #1 #2 +} end when m/*0:*/::int = #xs/*0:01*/ { + rule #0: m::int = #xs + state 0: #0 + <var>::int state 1 + state 1: #0 +} end; +n1/*0:0101*/,n2/*0:011*/..m/*0:1*/ = while (\i/*0:*/ -> s/*1:*/*i/*0:*/<=s/*1:*/*m/*3:1*/ { + rule #0: i = s*i<=s*m + state 0: #0 + <var> state 1 + state 1: #0 +}) (\x/*0:*/ -> x/*0:*/+k/*2:*/ { + rule #0: x = x+k + state 0: #0 + <var> state 1 + state 1: #0 +}) n1/*2:0101*/ when k/*0:*/ = n2/*0:011*/-n1/*0:0101*/; s/*0:*/ = if k/*0:*/>0 then 1 else -1 { + rule #0: s = if k>0 then 1 else -1 + state 0: #0 + <var> state 1 + state 1: #0 +} { + rule #0: k = n2-n1 + state 0: #0 + <var> state 1 + state 1: #0 +} end if n1/*0:0101*/!=n2/*0:011*/; +n/*0:01*/..m/*0:1*/ = while (\i/*0:*/ -> i/*0:*/<=m/*1:1*/ { + rule #0: i = i<=m + state 0: #0 + <var> state 1 + state 1: #0 +}) (\x/*0:*/ -> x/*0:*/+1 { + rule #0: x = x+1 + state 0: #0 + <var> state 1 + state 1: #0 +}) n/*0:01*/; +all p/*0:01*/ [] = 1; +all p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/&&all p/*0:01*/ xs/*0:11*/; +any p/*0:01*/ [] = 0; +any p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = p/*0:01*/ x/*0:101*/||any p/*0:01*/ xs/*0:11*/; +do f/*0:01*/ [] = (); +do f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = do f/*1:01*/ xs/*1:11*/ when _/*0:*/ = f/*0:01*/ x/*0:101*/ { + rule #0: _ = f x + state 0: #0 + <var> state 1 + state 1: #0 +} end; +drop n/*0:01*/ [] = []; +drop n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = drop (n/*0:01*/-1) xs/*0:11*/ if n/*0:01*/>0; +drop n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:xs/*0:11*/; +dropwhile p/*0:01*/ [] = []; +dropwhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = dropwhile p/*0:01*/ xs/*0:11*/ if p/*0:01*/ x/*0:101*/; +dropwhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:xs/*0:11*/; +filter p/*0:01*/ [] = []; +filter p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:filter p/*0:01*/ xs/*0:11*/ if p/*0:01*/ x/*0:101*/; +filter p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = filter p/*0:01*/ xs/*0:11*/; +foldl f/*0:001*/ a/*0:01*/ [] = a/*0:01*/; +foldl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldl f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; +foldl1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = foldl f/*0:01*/ x/*0:101*/ xs/*0:11*/; +foldr f/*0:001*/ a/*0:01*/ [] = a/*0:01*/; +foldr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:001*/ x/*0:101*/ (foldr f/*0:001*/ a/*0:01*/ xs/*0:11*/); +foldr1 f/*0:01*/ [x/*0:101*/] = x/*0:101*/; +foldr1 f/*0:01*/ (x/*0:101*/:y/*0:1101*/:xs/*0:111*/) = f/*0:01*/ x/*0:101*/ (foldr1 f/*0:01*/ (y/*0:1101*/:xs/*0:111*/)); +head (x/*0:101*/:xs/*0:11*/) = x/*0:101*/; +init [x/*0:101*/] = []; +init (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:init xs/*0:11*/; +last [x/*0:101*/] = x/*0:101*/; +last (x/*0:101*/:xs/*0:11*/) = last xs/*0:11*/; +map f/*0:01*/ [] = []; +map f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*0:01*/ x/*0:101*/:map f/*0:01*/ xs/*0:11*/; +scanl f/*0:001*/ a/*0:01*/ [] = [a/*0:01*/]; +scanl f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = a/*0:01*/:scanl f/*0:001*/ (f/*0:001*/ a/*0:01*/ x/*0:101*/) xs/*0:11*/; +scanl1 f/*0:01*/ [] = []; +scanl1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = scanl f/*0:01*/ x/*0:101*/ xs/*0:11*/; +scanr f/*0:001*/ a/*0:01*/ [] = [a/*0:01*/]; +scanr f/*0:001*/ a/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*2:001*/ x/*2:101*/ y/*0:01*/:ys/*1:*/ when ys/*0:*/ = scanr f/*0:001*/ a/*0:01*/ xs/*0:11*/; y/*0:01*/:_/*0:1*/ = ys/*0:*/ { + rule #0: y:_ = ys + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + : state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} { + rule #0: ys = scanr f a xs + state 0: #0 + <var> state 1 + state 1: #0 +} end; +scanr1 f/*0:01*/ [] = []; +scanr1 f/*0:01*/ [x/*0:101*/] = [x/*0:101*/]; +scanr1 f/*0:01*/ (x/*0:101*/:xs/*0:11*/) = f/*2:01*/ x/*2:101*/ y/*0:01*/:ys/*1:*/ when ys/*0:*/ = scanr1 f/*0:01*/ xs/*0:11*/; y/*0:01*/:_/*0:1*/ = ys/*0:*/ { + rule #0: y:_ = ys + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + : state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} { + rule #0: ys = scanr1 f xs + state 0: #0 + <var> state 1 + state 1: #0 +} end; +tail (x/*0:101*/:xs/*0:11*/) = xs/*0:11*/; +take n/*0:01*/ [] = []; +take n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:take (n/*0:01*/-1) xs/*0:11*/ if n/*0:01*/>0; +take n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = []; +takewhile p/*0:01*/ [] = []; +takewhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = x/*0:101*/:takewhile p/*0:01*/ xs/*0:11*/ if p/*0:01*/ x/*0:101*/; +takewhile p/*0:01*/ (x/*0:101*/:xs/*0:11*/) = []; +cat [] = []; +cat (xs/*0:101*/:xss/*0:11*/) = accum/*0*/ (reverse xs/*0:101*/) xss/*0:11*/ with accum xs/*0:01*/ [] = reverse xs/*0:01*/; accum xs/*0:01*/ ([]:yss/*0:11*/) = accum/*1*/ xs/*0:01*/ yss/*0:11*/; accum xs/*0:01*/ ((y/*0:10101*/:ys/*0:1011*/):yss/*0:11*/) = accum/*1*/ (y/*0:10101*/:xs/*0:01*/) (ys/*0:1011*/:yss/*0:11*/); accum xs/*0:01*/ yss/*0:1*/ = reverse xs/*0:01*/+cat yss/*0:1*/ { + rule #0: accum xs [] = reverse xs + rule #1: accum xs ([]:yss) = accum xs yss + rule #2: accum xs ((y:ys):yss) = accum (y:xs) (ys:yss) + rule #3: accum xs yss = reverse xs+cat yss + state 0: #0 #1 #2 #3 + <var> state 1 + state 1: #0 #1 #2 #3 + <var> state 2 + [] state 3 + <app> state 4 + state 2: #3 + state 3: #0 #3 + state 4: #1 #2 #3 + <var> state 5 + <app> state 7 + state 5: #3 + <var> state 6 + state 6: #3 + state 7: #1 #2 #3 + <var> state 8 + : state 11 + state 8: #3 + <var> state 9 + state 9: #3 + <var> state 10 + state 10: #3 + state 11: #1 #2 #3 + <var> state 12 + [] state 14 + <app> state 16 + state 12: #3 + <var> state 13 + state 13: #3 + state 14: #1 #3 + <var> state 15 + state 15: #1 #3 + state 16: #2 #3 + <var> state 17 + <app> state 20 + state 17: #3 + <var> state 18 + state 18: #3 + <var> state 19 + state 19: #3 + state 20: #2 #3 + <var> state 21 + : state 25 + state 21: #3 + <var> state 22 + state 22: #3 + <var> state 23 + state 23: #3 + <var> state 24 + state 24: #3 + state 25: #2 #3 + <var> state 26 + state 26: #2 #3 + <var> state 27 + state 27: #2 #3 + <var> state 28 + state 28: #2 #3 +} end if listp xs/*0:101*/; +catmap f/*0:01*/ xs/*0:1*/ = cat (map f/*0:01*/ xs/*0:1*/); +reverse xs/*0:1*/ = foldl (flip (:)) [] xs/*0:1*/ if listp xs/*0:1*/; +repeat n/*0:01*/ x/*0:1*/ = [] if n/*0:01*/<=0; +repeat n/*0:01*/ x/*0:1*/ = x/*0:1*/:repeat (n/*0:01*/-1) x/*0:1*/; +cycle n/*0:01*/ [] = []; +cycle n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = [] if n/*0:01*/<=0; +cycle n/*0:01*/ (x/*0:101*/:xs/*0:11*/) = mkcycle/*0*/ n/*2:01*/ xs/*1:*/ with mkcycle n/*0:01*/ xs/*0:1*/ = take n/*0:01*/ xs/*0:1*/ if n/*0:01*/<=m/*1:*/; mkcycle n/*0:01*/ xs/*0:1*/ = xs/*0:1*/+mkcycle/*1*/ (n/*0:01*/-m/*1:*/) xs/*0:1*/ { + rule #0: mkcycle n xs = take n xs if n<=m + rule #1: mkcycle n xs = xs+mkcycle (n-m) xs + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 + <var> state 2 + state 2: #0 #1 +} end when xs/*0:*/ = x/*0:101*/:xs/*0:11*/; m/*0:*/ = #xs/*0:*/ { + rule #0: m = #xs + state 0: #0 + <var> state 1 + state 1: #0 +} { + rule #0: xs = x:xs + state 0: #0 + <var> state 1 + state 1: #0 +} end; +while p/*0:001*/ f/*0:01*/ a/*0:1*/ = a/*0:1*/:while p/*0:001*/ f/*0:01*/ (f/*0:01*/ a/*0:1*/) if p/*0:001*/ a/*0:1*/; +while p/*0:001*/ f/*0:01*/ a/*0:1*/ = []; +until p/*0:001*/ f/*0:01*/ a/*0:1*/ = [] if p/*0:001*/ a/*0:1*/; +until p/*0:001*/ f/*0:01*/ a/*0:1*/ = a/*0:1*/:until p/*0:001*/ f/*0:01*/ (f/*0:01*/ a/*0:1*/); +zip (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = (x/*0:0101*/,y/*0:101*/):zip xs/*0:011*/ ys/*0:11*/; +zip _/*0:01*/ _/*0:1*/ = []; +zip3 (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = (x/*0:00101*/,y/*0:0101*/,z/*0:101*/):zip3 xs/*0:0011*/ ys/*0:011*/ zs/*0:11*/; +zip3 _/*0:001*/ _/*0:01*/ _/*0:1*/ = []; +zipwith f/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = f/*0:001*/ x/*0:0101*/ y/*0:101*/:zipwith f/*0:001*/ xs/*0:011*/ ys/*0:11*/; +zipwith f/*0:001*/ _/*0:01*/ _/*0:1*/ = []; +zipwith3 f/*0:0001*/ (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = f/*0:0001*/ x/*0:00101*/ y/*0:0101*/ z/*0:101*/:zipwith3 f/*0:0001*/ xs/*0:0011*/ ys/*0:011*/ zs/*0:11*/; +zipwith3 f/*0:0001*/ _/*0:001*/ _/*0:01*/ _/*0:1*/ = []; +dowith f/*0:001*/ (x/*0:0101*/:xs/*0:011*/) (y/*0:101*/:ys/*0:11*/) = dowith f/*1:001*/ xs/*1:011*/ ys/*1:11*/ when _/*0:*/ = f/*0:001*/ x/*0:0101*/ y/*0:101*/ { + rule #0: _ = f x y + state 0: #0 + <var> state 1 + state 1: #0 +} end; +dowith f/*0:001*/ _/*0:01*/ _/*0:1*/ = (); +dowith3 f/*0:0001*/ (x/*0:00101*/:xs/*0:0011*/) (y/*0:0101*/:ys/*0:011*/) (z/*0:101*/:zs/*0:11*/) = dowith3 f/*1:0001*/ xs/*1:0011*/ ys/*1:011*/ zs/*1:11*/ when _/*0:*/ = f/*0:0001*/ x/*0:00101*/ y/*0:0101*/ z/*0:101*/ { + rule #0: _ = f x y z + state 0: #0 + <var> state 1 + state 1: #0 +} end; +dowith3 f/*0:0001*/ _/*0:001*/ _/*0:01*/ _/*0:1*/ = (); +unzip ((x/*0:10101*/,y/*0:1011*/):us/*0:11*/) = x/*1:10101*/:xs/*0:01*/,y/*1:1011*/:ys/*0:1*/ when xs/*0:01*/,ys/*0:1*/ = unzip us/*0:11*/ { + rule #0: xs,ys = unzip us + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end; +unzip [] = [],[]; +unzip3 ((x/*0:10101*/,y/*0:101101*/,z/*0:10111*/):us/*0:11*/) = x/*1:10101*/:xs/*0:01*/,y/*1:101101*/:ys/*0:101*/,z/*1:10111*/:zs/*0:11*/ when xs/*0:01*/,ys/*0:101*/,zs/*0:11*/ = unzip3 us/*0:11*/ { + rule #0: xs,ys,zs = unzip3 us + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <app> state 5 + state 5: #0 + <app> state 6 + state 6: #0 + , state 7 + state 7: #0 + <var> state 8 + state 8: #0 + <var> state 9 + state 9: #0 +} end; +unzip3 [] = [],[],[]; Added: pure/trunk/test/test1.log =================================================================== --- pure/trunk/test/test1.log (rev 0) +++ pure/trunk/test/test1.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,182 @@ +square x/*0:1*/ = x/*0:1*/*x/*0:1*/; +{ + rule #0: square x = x*x + state 0: #0 + <var> state 1 + state 1: #0 +} +square 5; +25 +fact1 n/*0:1*/ = n/*0:1*/*fact1 (n/*0:1*/-1) if n/*0:1*/>0; +fact1 n/*0:1*/ = 1; +{ + rule #0: fact1 n = n*fact1 (n-1) if n>0 + rule #1: fact1 n = 1 + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 +} +{ + rule #0: x = fact1 10 + state 0: #0 + <var> state 1 + state 1: #0 +} +let x = fact1 10; +fact2 n/*0:1*/ = case n/*0:1*/ of n/*0:*/ = n/*0:*/*fact2 (n/*0:*/-1) if n/*0:*/>0; n/*0:*/ = 1 { + rule #0: n = n*fact2 (n-1) if n>0 + rule #1: n = 1 + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 +} end; +fact3 n/*0:1*/ = case n/*0:1*/ of 0 = 1; n/*0:*/ = n/*0:*/*fact3 (n/*0:*/-1) if n/*0:*/>1 { + rule #0: 0 = 1 + rule #1: n = n*fact3 (n-1) if n>1 + state 0: #0 #1 + <var> state 1 + 0::int state 2 + state 1: #1 + state 2: #0 #1 +} end; +fact4 n/*0:1*/ = if n/*0:1*/>0 then n/*0:1*/*fact4 (n/*0:1*/-1) else 1; +fact5 = \n/*0:*/ -> if n/*0:*/>0 then n/*0:*/*fact5 (n/*0:*/-1) else 1 { + rule #0: n = if n>0 then n*fact5 (n-1) else 1 + state 0: #0 + <var> state 1 + state 1: #0 +}; +fact n/*0:1*/::int = fact (bigint n/*0:1*/); +fact n/*0:1*/::bigint = n/*0:1*/*fact (n/*0:1*/-1) if n/*0:1*/>0; +fact n/*0:1*/::bigint = 1; +fib1 0 = 0; +fib1 1 = 1; +fib1 n/*0:1*/ = fib1 (n/*0:1*/-2)+fib1 (n/*0:1*/-1) if n/*0:1*/>1; +fib2 n/*0:1*/ = case fibs/*0*/ n/*0:1*/ of a/*0:01*/,b/*0:1*/ = a/*0:01*/ { + rule #0: a,b = a + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end with fibs n/*0:1*/ = 0,1 if n/*0:1*/<=0; fibs n/*0:1*/ = case fibs/*1*/ (n/*0:1*/-1) of a/*0:01*/,b/*0:1*/ = b/*0:1*/,a/*0:01*/+b/*0:1*/ { + rule #0: a,b = b,a+b + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end { + rule #0: fibs n = 0,1 if n<=0 + rule #1: fibs n = case fibs (n-1) of a,b = b,a+b end + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 +} end; +fib3 n/*0:1*/ = a/*0:01*/ when a/*0:01*/,b/*0:1*/ = fibs/*0*/ n/*0:1*/ { + rule #0: a,b = fibs n + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end with fibs n/*0:1*/ = 0,1 if n/*0:1*/<=0; fibs n/*0:1*/ = b/*0:1*/,a/*0:01*/+b/*0:1*/ when a/*0:01*/,b/*0:1*/ = fibs/*1*/ (n/*0:1*/-1) { + rule #0: a,b = fibs (n-1) + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end { + rule #0: fibs n = 0,1 if n<=0 + rule #1: fibs n = b,a+b when a,b = fibs (n-1) end + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 +} end; +{ + rule #0: fact2 n = case n of n = n*fact2 (n-1) if n>0; n = 1 end + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: fact3 n = case n of 0 = 1; n = n*fact3 (n-1) if n>1 end + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: fact4 n = if n>0 then n*fact4 (n-1) else 1 + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: fact5 = \n -> if n>0 then n*fact5 (n-1) else 1 + state 0: #0 +} +{ + rule #0: fact n::int = fact (bigint n) + rule #1: fact n::bigint = n*fact (n-1) if n>0 + rule #2: fact n::bigint = 1 + state 0: #0 #1 #2 + <var>::int state 1 + <var>::bigint state 2 + state 1: #0 + state 2: #1 #2 +} +{ + rule #0: fib1 0 = 0 + rule #1: fib1 1 = 1 + rule #2: fib1 n = fib1 (n-2)+fib1 (n-1) if n>1 + state 0: #0 #1 #2 + <var> state 1 + 0::int state 2 + 1::int state 3 + state 1: #2 + state 2: #0 #2 + state 3: #1 #2 +} +{ + rule #0: fib2 n = case fibs n of a,b = a end with fibs n = 0,1 if n<=0; fibs n = case fibs (n-1) of a,b = b,a+b end end + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: fib3 n = a when a,b = fibs n end with fibs n = 0,1 if n<=0; fibs n = b,a+b when a,b = fibs (n-1) end end + state 0: #0 + <var> state 1 + state 1: #0 +} +map fib1 (1..10); +[1,1,2,3,5,8,13,21,34,55] +map fib2 (1..10); +[1,1,2,3,5,8,13,21,34,55] +map fib3 (1..10); +[1,1,2,3,5,8,13,21,34,55] Added: pure/trunk/test/test2.log =================================================================== --- pure/trunk/test/test2.log (rev 0) +++ pure/trunk/test/test2.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,63 @@ +fib n/*0:1*/ = a/*0:01*/ when a/*0:01*/,b/*0:1*/ = fibs/*0*/ n/*0:1*/ { + rule #0: a,b = fibs n + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end with fibs n/*0:1*/ = 0,1 if n/*0:1*/<=0; fibs n/*0:1*/ = b/*0:1*/,a/*0:01*/+b/*0:1*/ when a/*0:01*/,b/*0:1*/ = fibs/*1*/ (n/*0:1*/-1) { + rule #0: a,b = fibs (n-1) + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end { + rule #0: fibs n = 0,1 if n<=0 + rule #1: fibs n = b,a+b when a,b = fibs (n-1) end + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 +} end; +fib2 n/*0:1*/ = a/*0:01*/ when a/*0:01*/,b/*0:1*/ = fibs/*0*/ (0,1) n/*0:1*/ { + rule #0: a,b = fibs (0,1) n + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} end with fibs (a/*0:0101*/,b/*0:011*/) n/*0:1*/ = a/*0:0101*/,b/*0:011*/ if n/*0:1*/<=0; fibs (a/*0:0101*/,b/*0:011*/) n/*0:1*/ = fibs/*1*/ (b/*0:011*/,bigint a/*0:0101*/+b/*0:011*/) (n/*0:1*/-1) { + rule #0: fibs (a,b) n = a,b if n<=0 + rule #1: fibs (a,b) n = fibs (b,bigint a+b) (n-1) + state 0: #0 #1 + <app> state 1 + state 1: #0 #1 + <app> state 2 + state 2: #0 #1 + , state 3 + state 3: #0 #1 + <var> state 4 + state 4: #0 #1 + <var> state 5 + state 5: #0 #1 + <var> state 6 + state 6: #0 #1 +} end; Added: pure/trunk/test/test3.log =================================================================== --- pure/trunk/test/test3.log (rev 0) +++ pure/trunk/test/test3.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,20 @@ +fibs n/*0:1*/ = 0,1 if n/*0:1*/<=0; +fibs n/*0:1*/ = b/*0:1*/,a/*0:01*/+b/*0:1*/ when m/*0:*/ = n/*0:1*/-1; a/*0:01*/,b/*0:1*/ = fibs m/*0:*/ { + rule #0: a,b = fibs m + state 0: #0 + <app> state 1 + state 1: #0 + <app> state 2 + state 2: #0 + , state 3 + state 3: #0 + <var> state 4 + state 4: #0 + <var> state 5 + state 5: #0 +} { + rule #0: m = n-1 + state 0: #0 + <var> state 1 + state 1: #0 +} end; Added: pure/trunk/test/test4.log =================================================================== --- pure/trunk/test/test4.log (rev 0) +++ pure/trunk/test/test4.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,103 @@ +foo x/*0:1*/ = bar/*0*/ with bar = x/*1:1*/ { + rule #0: bar = x + state 0: #0 +} end; +foo2 x/*0:1*/ = bar/*0*/ x/*0:1*/ with bar 99 = bar/*1*/ (x/*1:1*/+1) { + rule #0: bar 99 = bar (x+1) + state 0: #0 + 99::int state 1 + state 1: #0 +} end; +foo3 x/*0:1*/ = bar/*0*/ with bar y/*0:1*/ = bar/*1*/ (y/*0:1*/+1) if y/*0:1*/==x/*1:1*/ { + rule #0: bar y = bar (y+1) if y==x + state 0: #0 + <var> state 1 + state 1: #0 +} end; +{ + rule #0: foo x = bar with bar = x end + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: foo2 x = bar x with bar 99 = bar (x+1) end + state 0: #0 + <var> state 1 + state 1: #0 +} +{ + rule #0: foo3 x = bar with bar y = bar (y+1) if y==x end + state 0: #0 + <var> state 1 + state 1: #0 +} +foo 99; +99 +foo2 99; +bar 100 +foo2 98; +bar 98 +foo3 99; +bar +foo3 99 98; +bar 98 +foo3 99 99; +bar 100 +loop = loop; +count n/*0:1*/ = ct/*0*/ n/*0:1*/ with ct n/*0:1*/::int = n/*0:1*/ if n/*0:1*/<=0; ct n/*0:1*/::int = ct/*1*/ (n/*0:1*/-1) { + rule #0: ct n::int = n if n<=0 + rule #1: ct n::int = ct (n-1) + state 0: #0 #1 + <var>::int state 1 + state 1: #0 #1 +} end; +{ + rule #0: loop = loop + state 0: #0 +} +{ + rule #0: count n = ct n with ct n::int = n if n<=0; ct n::int = ct (n-1) end + state 0: #0 + <var> state 1 + state 1: #0 +} +count 100; +0 +count 10000000; +0 +count2 n/*0:1*/::int = n/*0:1*/ if n/*0:1*/<=0; +count2 n/*0:1*/::int = count2 (n/*0:1*/-1); +{ + rule #0: count2 n::int = n if n<=0 + rule #1: count2 n::int = count2 (n-1) + state 0: #0 #1 + <var>::int state 1 + state 1: #0 #1 +} +count2 100; +0 +count2 10000000; +0 +test x/*0:1*/::int = t/*0*/ x/*0:1*/ with t n/*0:1*/::int = t/*1*/ (-n/*0:1*/) if n/*0:1*/<0; t n/*0:1*/::int = u/*0*/ (n/*0:1*/+2) with u _/*0:1*/ = n/*1:1*/+1 { + rule #0: u _ = n+1 + state 0: #0 + <var> state 1 + state 1: #0 +} end { + rule #0: t n::int = t (-n) if n<0 + rule #1: t n::int = u (n+2) with u _ = n+1 end + state 0: #0 #1 + <var>::int state 1 + state 1: #0 #1 +} end; +{ + rule #0: test x::int = t x with t n::int = t (-n) if n<0; t n::int = u (n+2) with u _ = n+1 end end + state 0: #0 + <var>::int state 1 + state 1: #0 +} +test 98; +99 +test (-97); +98 Added: pure/trunk/test/test5.log =================================================================== --- pure/trunk/test/test5.log (rev 0) +++ pure/trunk/test/test5.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,13 @@ +fact 0 = 1; +fact n/*0:1*/ = n/*0:1*/*fact (n/*0:1*/-1); +{ + rule #0: fact 0 = 1 + rule #1: fact n = n*fact (n-1) + state 0: #0 #1 + <var> state 1 + 0::int state 2 + state 1: #1 + state 2: #0 #1 +} +fact 4; +24 Added: pure/trunk/test/test6.log =================================================================== --- pure/trunk/test/test6.log (rev 0) +++ pure/trunk/test/test6.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,11 @@ +fact n/*0:1*/ = 1 if n/*0:1*/==0; +fact n/*0:1*/ = n/*0:1*/*fact (n/*0:1*/-1); +{ + rule #0: fact n = 1 if n==0 + rule #1: fact n = n*fact (n-1) + state 0: #0 #1 + <var> state 1 + state 1: #0 #1 +} +fact 4; +24 Added: pure/trunk/test/test7.log =================================================================== --- pure/trunk/test/test7.log (rev 0) +++ pure/trunk/test/test7.log 2008-05-02 20:30:47 UTC (rev 31) @@ -0,0 +1,19 @@ +{ + rule #0: y = \a -> \b -> a+b + state 0: #0 + <var> state 1 + state 1: #0 +} +let y = \a/*0:*/ -> \b/*0:*/ -> a/*1:*/+b/*0:*/ { + rule #0: b = a+b + state 0: #0 + <var> state 1 + state 1: #0 +} { + rule #0: a = \b -> a+b + state 0: #0 + <var> state 1 + state 1: #0 +}; +y 1 5; +6 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 09:04:10
|
Revision: 30 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=30&view=rev Author: agraef Date: 2008-05-02 02:04:18 -0700 (Fri, 02 May 2008) Log Message: ----------- Added syntactic equality. Modified Paths: -------------- pure/trunk/ChangeLog pure/trunk/lib/prelude.pure pure/trunk/lib/primitives.pure pure/trunk/runtime.cc pure/trunk/runtime.h Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-02 07:09:21 UTC (rev 29) +++ pure/trunk/ChangeLog 2008-05-02 09:04:18 UTC (rev 30) @@ -1,5 +1,8 @@ 2008-05-02 Albert Graef <Dr....@t-...> + * runtime.cc (same): Added a syntactic equality test. Requested by + Eddie Rucker. + * Makefile: Add $(LDFLAGS) and $(LIBS) to the link line, so that the user can easily add his own linker options and local libraries. Modified: pure/trunk/lib/prelude.pure =================================================================== --- pure/trunk/lib/prelude.pure 2008-05-02 07:09:21 UTC (rev 29) +++ pure/trunk/lib/prelude.pure 2008-05-02 09:04:18 UTC (rev 30) @@ -41,6 +41,7 @@ infixr 3 && ; // logical and (short-circuit) prefix 3 not ; // logical negation infix 4 < > <= >= == != ; // relations +infix 4 === !== ; // syntactic equality infixr 4 : ; // list cons infixl 5 << >> ; // bit shifts infixl 6 + - | ; // addition, bitwise or Modified: pure/trunk/lib/primitives.pure =================================================================== --- pure/trunk/lib/primitives.pure 2008-05-02 07:09:21 UTC (rev 29) +++ pure/trunk/lib/primitives.pure 2008-05-02 09:04:18 UTC (rev 30) @@ -24,6 +24,12 @@ extern void pure_throw(expr*); // IMPURE! throw x = pure_throw x; +/* Syntactic equality. */ + +extern bool same(expr* x, expr* y); +x === y = same x y; +x !== y = not same x y; + /* Predicates to check for the built-in types. */ intp x = case x of _::int = 1; _ = 0 end; Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-05-02 07:09:21 UTC (rev 29) +++ pure/trunk/runtime.cc 2008-05-02 09:04:18 UTC (rev 30) @@ -1059,6 +1059,42 @@ } extern "C" +bool same(const pure_expr *x, const pure_expr *y) +{ + char test; + if (x == y) + return 1; + else if (x->tag >= 0 && y->tag >= 0) + if (x->data.clos && y->data.clos) + return x->tag == y->tag && x->data.clos->fp == y->data.clos->fp; + else + return x->tag == y->tag && x->data.clos == y->data.clos; + else if (x->tag != y->tag) + return 0; + else { + switch (x->tag) { + case EXPR::APP: { + checkstk(test); + return same(x->data.x[0], y->data.x[0]) && + same(x->data.x[1], y->data.x[1]); + } + case EXPR::INT: + return x->data.i == y->data.i; + case EXPR::BIGINT: + return mpz_cmp(x->data.z, y->data.z) == 0; + case EXPR::DBL: + return x->data.d == y->data.d; + case EXPR::STR: + return strcmp(x->data.s, y->data.s) == 0; + case EXPR::PTR: + return x->data.p == y->data.p; + default: + return 1; + } + } +} + +extern "C" int32_t pointer_get_byte(void *ptr) { uint8_t *p = (uint8_t*)ptr; Modified: pure/trunk/runtime.h =================================================================== --- pure/trunk/runtime.h 2008-05-02 07:09:21 UTC (rev 29) +++ pure/trunk/runtime.h 2008-05-02 09:04:18 UTC (rev 30) @@ -252,6 +252,10 @@ pure_expr *str(const pure_expr *x); pure_expr *eval(const char *s); +/* Check whether two objects are the "same" (syntactically). */ + +bool same(const pure_expr *x, const pure_expr *y); + /* Direct memory accesses. */ int32_t pointer_get_byte(void *ptr); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 07:09:14
|
Revision: 29 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=29&view=rev Author: agraef Date: 2008-05-02 00:09:21 -0700 (Fri, 02 May 2008) Log Message: ----------- Updated README. Modified Paths: -------------- pure/trunk/README Modified: pure/trunk/README =================================================================== --- pure/trunk/README 2008-05-02 07:03:42 UTC (rev 28) +++ pure/trunk/README 2008-05-02 07:09:21 UTC (rev 29) @@ -44,14 +44,18 @@ be changed at runtime by setting corresponding environment variables, see the manpage for details). -You can (and should) also run 'make check' to verify that your Pure -interpreter works correctly. This can be done without installing the software. -In fact, there's no need to install the interpreter if you just want to take -it for a test drive, you can simply run it from the source directory. Just -make sure that you set the PURELIB environment variable to the lib directory -in the sources which holds the prelude and the other library scripts. The -following command, +There are a number of other variables you can set on the 'make' command line +if you need special compiler (CXXFLAGS) or linker flags (LDFLAGS), or if you +have to add special libraries (LIBS) like libiconv on OSX. +After your build is done, you can (and should) also run 'make check' to verify +that your Pure interpreter works correctly. This can be done without +installing the software. In fact, there's no need to install the interpreter +if you just want to take it for a test drive, you can simply run it from the +source directory. Just make sure that you set the PURELIB environment variable +to the lib directory in the sources which holds the prelude and the other +library scripts. The following command, + PURELIB=./lib ./pure will run the Pure interpreter with that setting in Bourne-compatible shells. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 07:03:39
|
Revision: 28 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=28&view=rev Author: agraef Date: 2008-05-02 00:03:42 -0700 (Fri, 02 May 2008) Log Message: ----------- Updated ChangeLog. Modified Paths: -------------- pure/trunk/ChangeLog Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-02 07:01:38 UTC (rev 27) +++ pure/trunk/ChangeLog 2008-05-02 07:03:42 UTC (rev 28) @@ -1,5 +1,9 @@ 2008-05-02 Albert Graef <Dr....@t-...> + * Makefile: Add $(LDFLAGS) and $(LIBS) to the link line, so that + the user can easily add his own linker options and local + libraries. + * lib/strings.pure: Add missing range check in string indexing operation. Reported by Eddie Rucker. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 07:01:32
|
Revision: 27 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=27&view=rev Author: agraef Date: 2008-05-02 00:01:38 -0700 (Fri, 02 May 2008) Log Message: ----------- Add $(LDFLAGS) and $(LIBS) to the link line. Modified Paths: -------------- pure/trunk/Makefile Modified: pure/trunk/Makefile =================================================================== --- pure/trunk/Makefile 2008-05-02 05:46:36 UTC (rev 26) +++ pure/trunk/Makefile 2008-05-02 07:01:38 UTC (rev 27) @@ -72,7 +72,7 @@ runtime.cc runtime.h symtable.cc symtable.hh util.cc util.hh EXTRA_SOURCE = lexer.cc parser.cc parser.hh location.hh position.hh stack.hh OBJECT = $(subst .cc,.o,$(filter %.cc,$(SOURCE) $(EXTRA_SOURCE))) -LIBS = $(LLVM_LIBS) -lreadline -lgmp +ALL_LIBS = $(LLVM_LIBS) -lreadline -lgmp $(LIBS) examples = $(wildcard examples/*.pure) lib = $(wildcard lib/*.pure) @@ -92,7 +92,7 @@ all: pure pure: $(OBJECT) - $(CXX) -o $@ -rdynamic $(OBJECT) $(LIBS) + $(CXX) -o $@ $(LDFLAGS) -rdynamic $(OBJECT) $(ALL_LIBS) pure.o: pure.cc $(CXX) $(CXXFLAGS) -DVERSION='"$(version)"' -DPURELIB='"$(libdir)"' -c -o $@ $< This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 05:46:29
|
Revision: 26 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=26&view=rev Author: agraef Date: 2008-05-01 22:46:36 -0700 (Thu, 01 May 2008) Log Message: ----------- Updated ChangeLog. Modified Paths: -------------- pure/trunk/ChangeLog Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-02 05:45:38 UTC (rev 25) +++ pure/trunk/ChangeLog 2008-05-02 05:46:36 UTC (rev 26) @@ -1,5 +1,11 @@ 2008-05-02 Albert Graef <Dr....@t-...> + * lib/strings.pure: Add missing range check in string indexing + operation. Reported by Eddie Rucker. + + * printer.cc (operator <<): Handle stack overflow while printing + an expression. + * interpreter.cc (dodefn): Fix a tricky bug causing the executable code of closures bound to variables to be freed when it was still needed. Reported by Chris Double. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 05:45:30
|
Revision: 25 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=25&view=rev Author: agraef Date: 2008-05-01 22:45:38 -0700 (Thu, 01 May 2008) Log Message: ----------- Add missing range check in string indexing operation. Modified Paths: -------------- pure/trunk/lib/strings.pure Modified: pure/trunk/lib/strings.pure =================================================================== --- pure/trunk/lib/strings.pure 2008-05-02 05:31:22 UTC (rev 24) +++ pure/trunk/lib/strings.pure 2008-05-02 05:45:38 UTC (rev 25) @@ -88,7 +88,7 @@ null s::string = string_null s; #s::string = string_size s; -s::string!n::int = string_char_at s n if n>=0; +s::string!n::int = string_char_at s n if n>=0 && n<#s; s::string+t::string = string_concat s t; chars s::string = string_chars s; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 05:31:22
|
Revision: 24 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=24&view=rev Author: agraef Date: 2008-05-01 22:31:22 -0700 (Thu, 01 May 2008) Log Message: ----------- Catch stack overflow in printer. Modified Paths: -------------- pure/trunk/printer.cc pure/trunk/runtime.cc Modified: pure/trunk/printer.cc =================================================================== --- pure/trunk/printer.cc 2008-05-02 05:00:29 UTC (rev 23) +++ pure/trunk/printer.cc 2008-05-02 05:31:22 UTC (rev 24) @@ -606,6 +606,11 @@ ostream& operator << (ostream& os, const pure_expr *x) { + char test; + if (interpreter::stackmax > 0 && + interpreter::stackdir*(&test - interpreter::baseptr) >= + interpreter::stackmax) + throw err("stack overflow in printer"); char buf[64]; assert(x); //os << "{" << x->refc << "}"; Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-05-02 05:00:29 UTC (rev 23) +++ pure/trunk/runtime.cc 2008-05-02 05:31:22 UTC (rev 24) @@ -1040,8 +1040,12 @@ { assert(x); ostringstream os; - os << x; - return pure_string_dup(os.str().c_str()); + try { + os << x; + return pure_string_dup(os.str().c_str()); + } catch (err &e) { + return 0; + } } extern "C" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 05:00:23
|
Revision: 23 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=23&view=rev Author: agraef Date: 2008-05-01 22:00:29 -0700 (Thu, 01 May 2008) Log Message: ----------- Fix typo. Modified Paths: -------------- pure/trunk/pure.1 Modified: pure/trunk/pure.1 =================================================================== --- pure/trunk/pure.1 2008-05-02 03:59:07 UTC (rev 22) +++ pure/trunk/pure.1 2008-05-02 05:00:29 UTC (rev 23) @@ -689,7 +689,7 @@ > fact n = n*fact (n-1) \fBif\fP n>1; > \fBlet\fP x = fact 10; x; 3628800 -> map fact (1..10) +> map fact (1..10); [1,2,6,24,120,720,5040,40320,362880,3628800] .fi .PP This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 03:59:03
|
Revision: 22 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=22&view=rev Author: agraef Date: 2008-05-01 20:59:07 -0700 (Thu, 01 May 2008) Log Message: ----------- Add regression test for premature deallocation of closures bug. Added Paths: ----------- pure/trunk/test/test7.pure Added: pure/trunk/test/test7.pure =================================================================== --- pure/trunk/test/test7.pure (rev 0) +++ pure/trunk/test/test7.pure 2008-05-02 03:59:07 UTC (rev 22) @@ -0,0 +1,2 @@ +let y = (\a b -> a+b); +y 1 5; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 03:55:52
|
Revision: 21 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=21&view=rev Author: agraef Date: 2008-05-01 20:56:00 -0700 (Thu, 01 May 2008) Log Message: ----------- Updated ChangeLog. Modified Paths: -------------- pure/trunk/ChangeLog Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-02 03:55:18 UTC (rev 20) +++ pure/trunk/ChangeLog 2008-05-02 03:56:00 UTC (rev 21) @@ -1,3 +1,9 @@ +2008-05-02 Albert Graef <Dr....@t-...> + + * interpreter.cc (dodefn): Fix a tricky bug causing the executable + code of closures bound to variables to be freed when it was still + needed. Reported by Chris Double. + 2008-05-01 Albert Graef <Dr....@t-...> * interpreter.cc: Proper alignment of value fields in expression This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-02 03:55:10
|
Revision: 20 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=20&view=rev Author: agraef Date: 2008-05-01 20:55:18 -0700 (Thu, 01 May 2008) Log Message: ----------- Fix premature deallocation of closures bound in variable definitions. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/interpreter.hh pure/trunk/runtime.cc Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-01 15:29:39 UTC (rev 19) +++ pure/trunk/interpreter.cc 2008-05-02 03:55:18 UTC (rev 20) @@ -721,6 +721,7 @@ // patch up the global variable table to replace it with a cbox. map<int32_t,GlobalVar>::iterator v = globalvars.find(f); if (v != globalvars.end()) { + v->second.clear(); pure_expr *cv = pure_const(f); if (v->second.x) pure_free(v->second.x); v->second.x = pure_new(cv); @@ -1480,7 +1481,8 @@ v.v = new GlobalVariable (ExprPtrTy, false, GlobalVariable::ExternalLinkage, 0, sym.s, module); JIT->addGlobalMapping(v.v, &v.x); - } + } else + v.clear(); if (v.x) pure_free(v.x); v.x = pure_new(x); environ[tag] = env_info(&v.x, temp); restore_globals(g); @@ -1500,6 +1502,15 @@ return os << ")"; } +void GlobalVar::clear() +{ + if (e) { + assert(e->refc > 0); + if (--e->refc == 0) delete e; + e = 0; + } +} + Env& Env::operator= (const Env& e) { if (f) { @@ -1524,17 +1535,28 @@ interpreter& interp = *interpreter::g_interp; if (local) { // purge local functions +#if DEBUG>2 + llvm::cerr << "clearing local '" << name << "'\n"; +#endif + if (h != f) interp.JIT->freeMachineCodeForFunction(h); + interp.JIT->freeMachineCodeForFunction(f); f->dropAllReferences(); if (h != f) h->dropAllReferences(); + fp = 0; fmap.clear(); - interp.JIT->freeMachineCodeForFunction(f); - if (h != f) interp.JIT->freeMachineCodeForFunction(h); - fp = 0; to_be_deleted.push_back(f); if (h != f) to_be_deleted.push_back(h); } else { - // only delete the body, this keeps existing references intact - f->deleteBody(); - interp.JIT->freeMachineCodeForFunction(f); - if (h != f) interp.JIT->freeMachineCodeForFunction(h); +#if DEBUG>2 + llvm::cerr << "clearing global '" << name << "'\n"; +#endif + // The code of anonymous globals (doeval, dodefn) is taken care of + // elsewhere, we must not collect that here. + if (!name.empty()) { + // named global, get rid of the machine code + if (h != f) interp.JIT->freeMachineCodeForFunction(h); + interp.JIT->freeMachineCodeForFunction(f); + // only delete the body, this keeps existing references intact + f->deleteBody(); + } fp = 0; // delete all nested environments and reinitialize other body-related data fmap.clear(); xmap.clear(); xtab.clear(); prop.clear(); m = 0; argv = 0; @@ -2454,7 +2476,8 @@ (ExprPtrTy, false, GlobalVariable::InternalLinkage, 0, mkvarlabel(sym.f), module); JIT->addGlobalMapping(v.v, &v.x); - } + } else + v.clear(); if (v.x) pure_free(v.x); v.x = pure_new(cv); Value *defaultv = b.CreateLoad(v.v); vector<Value*> myargs(2); @@ -2522,6 +2545,7 @@ pure_expr *res = pure_invoke(f.fp, e); if (interactive && stats) clocks = clock()-t0; // Get rid of our anonymous function. + JIT->freeMachineCodeForFunction(f.f); f.f->eraseFromParent(); // NOTE: Result (if any) is to be freed by the caller. return res; @@ -2536,7 +2560,12 @@ } // Create an anonymous function to call in order to evaluate the rhs // expression, match against the lhs and bind variables in lhs accordingly. - Env f(0, 0, rhs, false); + /* NOTE: Unlike doeval(), we must create a semi-permanent environment here + whose child environments persist for the entire lifetime of the variables + bound in this definition, since some of those bindings may refer to + closures (executable code) that might still be called some time. */ + Env *fptr = new Env(0, 0, rhs, false); + Env &f = *fptr; push("dodefn", &f); fun_prolog(""); #if DEBUG>1 @@ -2573,9 +2602,16 @@ v.v = new GlobalVariable (ExprPtrTy, false, GlobalVariable::ExternalLinkage, 0, sym.s, module); JIT->addGlobalMapping(v.v, &v.x); - } + } else + v.clear(); + v.e = fptr; f.refc++; if (v.x) call("pure_free", f.builder.CreateLoad(v.v)); call("pure_new", x); +#if DEBUG>2 + ostringstream msg; + msg << "dodef: " << sym.s << " := %p"; + debug(msg.str().c_str(), x); +#endif f.builder.CreateStore(x, v.v); } // return the matchee to indicate success @@ -2594,6 +2630,7 @@ pure_expr *res = pure_invoke(f.fp, e); if (interactive && stats) clocks = clock()-t0; // Get rid of our anonymous function. + JIT->freeMachineCodeForFunction(f.f); f.f->eraseFromParent(); if (!res) { // We caught an exception, clean up the mess. @@ -2601,6 +2638,7 @@ int32_t tag = it->first; GlobalVar& v = globalvars[tag]; if (!v.x) { + v.clear(); JIT->updateGlobalMapping(v.v, 0); v.v->eraseFromParent(); globalvars.erase(tag); @@ -3288,7 +3326,8 @@ (ExprPtrTy, false, GlobalVariable::InternalLinkage, 0, mkvarlabel(tag), module); JIT->addGlobalMapping(v.v, &v.x); - } + } else + v.clear(); if (v.x) pure_free(v.x); v.x = pure_new(cv); return act_builder().CreateLoad(v.v); } Modified: pure/trunk/interpreter.hh =================================================================== --- pure/trunk/interpreter.hh 2008-05-01 15:29:39 UTC (rev 19) +++ pure/trunk/interpreter.hh 2008-05-02 03:55:18 UTC (rev 20) @@ -63,15 +63,17 @@ /* Data structures used in code generation. */ +struct Env; + struct GlobalVar { // global variable llvm::GlobalVariable* v; pure_expr *x; - GlobalVar() { v = 0; x = 0; } + Env *e; + GlobalVar() { v = 0; x = 0; e = 0; } + void clear(); }; -struct Env; - struct VarInfo { // info about captured variable uint32_t v; // local proxy (offset into extra parameter block) @@ -85,7 +87,6 @@ //#define Builder llvm::LLVMBuilder #define Builder llvm::LLVMFoldingBuilder -struct Env; typedef list<Env*> EnvStack; typedef pair<int32_t,uint8_t> xmap_key; @@ -126,6 +127,8 @@ Builder builder; // parent environment (if any) Env *parent; + // reference counter (for dodefn) + uint32_t refc; // convenience functions for invoking CreateGEP() and CreateLoad() llvm::Value *CreateGEP (llvm::Value *x, llvm::Value *i, const char* name = "") @@ -158,11 +161,11 @@ // default constructor Env() : tag(0), n(0), m(0), l(0), f(0), h(0), fp(0), args(0), envs(0), argv(0), - b(false), local(false), parent(0) {} + b(false), local(false), parent(0), refc(0) {} // environment for an anonymous closure with given body x Env(int32_t _tag, uint32_t _n, expr x, bool _b, bool _local = false) : tag(_tag), n(_n), m(0), l(0), f(0), h(0), fp(0), args(n), envs(0), - argv(0), b(_b), local(_local), parent(0) + argv(0), b(_b), local(_local), parent(0), refc(0) { if (envstk.empty()) { assert(!local); @@ -176,7 +179,7 @@ // environment for a named closure with given definition info Env(int32_t _tag, const env_info& info, bool _b, bool _local = false) : tag(_tag), n(info.argc), m(0), l(0), f(0), h(0), fp(0), args(n), envs(0), - argv(0), b(_b), local(_local), parent(0) + argv(0), b(_b), local(_local), parent(0), refc(0) { if (envstk.empty()) { assert(!local); Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-05-01 15:29:39 UTC (rev 19) +++ pure/trunk/runtime.cc 2008-05-02 03:55:18 UTC (rev 20) @@ -378,8 +378,16 @@ // parameterless call checkstk(test); return ((pure_expr*(*)())fp)(); - } else + } else { +#if DEBUG>2 + if (x->tag >= 0 && x->data.clos) + cerr << "pure_call: returning " << x << " -> " << x->data.clos->fp + << " (" << x->data.clos->n << " args)" << endl; + else + cerr << "pure_call: returning " << x << endl; +#endif return x; + } } extern "C" @@ -534,6 +542,9 @@ // Cast the function pointer to the right type (takes no arguments, returns // a pure_expr*), so we can call it as a native function. pure_expr *(*fp)() = (pure_expr*(*)())f; +#if DEBUG>1 + cerr << "pure_invoke: calling " << f << endl; +#endif // Push an exception. pure_exception ex; ex.e = 0; interp.estk.push_front(ex); // Call the function now. Catch exceptions generated by the runtime. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 15:29:32
|
Revision: 19 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=19&view=rev Author: agraef Date: 2008-05-01 08:29:39 -0700 (Thu, 01 May 2008) Log Message: ----------- Remove test7 again because it doesn't pass yet. Removed Paths: ------------- pure/trunk/test/test7.pure Deleted: pure/trunk/test/test7.pure =================================================================== --- pure/trunk/test/test7.pure 2008-05-01 15:27:14 UTC (rev 18) +++ pure/trunk/test/test7.pure 2008-05-01 15:29:39 UTC (rev 19) @@ -1,2 +0,0 @@ -let y = (\a b -> a+b); -y 1 5; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 15:27:09
|
Revision: 18 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=18&view=rev Author: agraef Date: 2008-05-01 08:27:14 -0700 (Thu, 01 May 2008) Log Message: ----------- Cosmetic changes in output of -v and list command. Modified Paths: -------------- pure/trunk/interpreter.cc pure/trunk/lexer.ll Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-01 09:38:20 UTC (rev 17) +++ pure/trunk/interpreter.cc 2008-05-01 15:27:14 UTC (rev 18) @@ -708,7 +708,7 @@ throw err(msg.str()); } if ((verbose&verbosity::defs) != 0) - cout << "let " << r->lhs << " = " << res << ";\n"; + cout << "let " << r->lhs << " = " << r->rhs << ";\n"; delete r; pure_freenew(res); if (interactive && stats) Modified: pure/trunk/lexer.ll =================================================================== --- pure/trunk/lexer.ll 2008-05-01 09:38:20 UTC (rev 17) +++ pure/trunk/lexer.ll 2008-05-01 15:27:14 UTC (rev 18) @@ -755,6 +755,7 @@ void interpreter::print_defs(ostream& os, const Env& e) { + if (e.h && e.h != e.f) e.h->print(os); e.f->print(os); map<int32_t,Env>::const_iterator f; for (f = e.fmap.begin(); f != e.fmap.end(); f++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 09:49:53
|
Revision: 17 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=17&view=rev Author: agraef Date: 2008-05-01 02:38:20 -0700 (Thu, 01 May 2008) Log Message: ----------- Updated ChangeLog. Modified Paths: -------------- pure/trunk/ChangeLog Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-01 09:36:07 UTC (rev 16) +++ pure/trunk/ChangeLog 2008-05-01 09:38:20 UTC (rev 17) @@ -1,5 +1,8 @@ 2008-05-01 Albert Graef <Dr....@t-...> + * interpreter.cc: Proper alignment of value fields in expression + struct on 64 bit systems. Reported by Tim Haynes. + * Makefile: g++ shouldn't be hardcoded, use $(CXX) instead. Reported by Ryan Schmidt. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 09:36:02
|
Revision: 16 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=16&view=rev Author: agraef Date: 2008-05-01 02:36:07 -0700 (Thu, 01 May 2008) Log Message: ----------- Fix issues with field alignment on 64 bit systems. Modified Paths: -------------- pure/trunk/interpreter.cc Modified: pure/trunk/interpreter.cc =================================================================== --- pure/trunk/interpreter.cc 2008-05-01 08:50:27 UTC (rev 15) +++ pure/trunk/interpreter.cc 2008-05-01 09:36:07 UTC (rev 16) @@ -134,10 +134,12 @@ ExprTy = cast<StructType>(StructTy.get()); module->addTypeName("struct.expr", ExprTy); } - // other variants + // Other variants. Note that on 64 bit systems we have to add a dummy field + // so that the following value field is aligned properly. { std::vector<const Type*> elts; elts.push_back(Type::Int32Ty); + if (sizeof(void*)==8) elts.push_back(Type::Int32Ty); // dummy elts.push_back(Type::Int32Ty); IntExprTy = StructType::get(elts); module->addTypeName("struct.intexpr", IntExprTy); @@ -145,6 +147,7 @@ { std::vector<const Type*> elts; elts.push_back(Type::Int32Ty); + if (sizeof(void*)==8) elts.push_back(Type::Int32Ty); // dummy elts.push_back(Type::DoubleTy); DblExprTy = StructType::get(elts); module->addTypeName("struct.dblexpr", DblExprTy); @@ -152,6 +155,7 @@ { std::vector<const Type*> elts; elts.push_back(Type::Int32Ty); + if (sizeof(void*)==8) elts.push_back(Type::Int32Ty); // dummy elts.push_back(PointerType::get(Type::Int8Ty, 0)); StrExprTy = StructType::get(elts); module->addTypeName("struct.strexpr", StrExprTy); @@ -159,6 +163,7 @@ { std::vector<const Type*> elts; elts.push_back(Type::Int32Ty); + if (sizeof(void*)==8) elts.push_back(Type::Int32Ty); // dummy elts.push_back(VoidPtrTy); PtrExprTy = StructType::get(elts); module->addTypeName("struct.ptrexpr", PtrExprTy); @@ -1410,6 +1415,7 @@ #define Zero UInt(0) #define One UInt(1) #define Two UInt(2) +#define ValFldIndex (sizeof(void*)==8?Two:One) #define NullExprPtr ConstantPointerNull::get(ExprPtrTy) #define NullExprPtrPtr ConstantPointerNull::get(ExprPtrPtrTy) @@ -2244,7 +2250,7 @@ f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); unboxed[i] = b.CreateICmpNE(iv, Zero); } else if (argt[i] == Type::Int8Ty) { @@ -2256,7 +2262,7 @@ f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); unboxed[i] = b.CreateTrunc(iv, Type::Int8Ty); } else if (argt[i] == Type::Int32Ty) { @@ -2268,7 +2274,7 @@ f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); unboxed[i] = iv; } else if (argt[i] == Type::Int64Ty) { @@ -2280,7 +2286,7 @@ f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); Value *pv = b.CreateBitCast(x, IntExprPtrTy, "intexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *iv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "intval"); unboxed[i] = b.CreateSExt(iv, Type::Int64Ty); } else if (argt[i] == Type::DoubleTy) { @@ -2292,7 +2298,7 @@ f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); Value *pv = b.CreateBitCast(x, DblExprPtrTy, "dblexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *dv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "dblval"); unboxed[i] = dv; } else if (argt[i] == PointerType::get(Type::Int8Ty, 0)) { @@ -2314,7 +2320,7 @@ f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); Value *pv = b.CreateBitCast(x, PtrExprPtrTy, "ptrexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *ptrv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "ptrval"); unboxed[i] = b.CreateBitCast(ptrv, argt[i]); } else if (argt[i] == PointerType::get(Type::DoubleTy, 0)) { @@ -2326,7 +2332,7 @@ f->getBasicBlockList().push_back(okbb); b.SetInsertPoint(okbb); Value *pv = b.CreateBitCast(x, PtrExprPtrTy, "ptrexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *ptrv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "ptrval"); unboxed[i] = b.CreateBitCast(ptrv, argt[i]); } else if (argt[i] == ExprPtrTy) { @@ -2353,7 +2359,7 @@ b.SetInsertPoint(ptrbb); // The following will work with both pointer and string expressions. Value *pv = b.CreateBitCast(x, PtrExprPtrTy, "ptrexpr"); - idx[1] = One; + idx[1] = ValFldIndex; Value *ptrv = b.CreateLoad(b.CreateGEP(pv, idx, idx+2), "ptrval"); b.CreateBr(okbb); f->getBasicBlockList().push_back(mpzbb); @@ -2670,7 +2676,7 @@ assert(x.tag() == EXPR::VAR); Value *u = codegen(x); Value *p = e.builder.CreateBitCast(u, IntExprPtrTy, "intexpr"); - Value *v = e.CreateLoadGEP(p, Zero, One, "intval"); + Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "intval"); // collect the temporary, it's not needed any more call("pure_freenew", u); return v; @@ -2679,7 +2685,7 @@ assert(x.tag() == EXPR::VAR && x.ttag() == EXPR::DBL); Value *u = codegen(x); Value *p = e.builder.CreateBitCast(u, DblExprPtrTy, "dblexpr"); - Value *v = e.CreateLoadGEP(p, Zero, One, "dblval"); + Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "dblval"); v = e.builder.CreateFPToSI(v, Type::Int32Ty); // collect the temporary, it's not needed any more call("pure_freenew", u); @@ -2693,7 +2699,7 @@ verify_tag(u, EXPR::INT); // get the value Value *p = e.builder.CreateBitCast(u, IntExprPtrTy, "intexpr"); - Value *v = e.CreateLoadGEP(p, Zero, One, "intval"); + Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "intval"); // collect the temporary, it's not needed any more call("pure_freenew", u); return v; @@ -2722,7 +2728,7 @@ assert(x.tag() == EXPR::VAR); Value *u = codegen(x); Value *p = e.builder.CreateBitCast(u, IntExprPtrTy, "intexpr"); - Value *v = e.CreateLoadGEP(p, Zero, One, "intval"); + Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "intval"); v = e.builder.CreateSIToFP(v, Type::DoubleTy); // collect the temporary, it's not needed any more call("pure_freenew", u); @@ -2732,7 +2738,7 @@ assert(x.tag() == EXPR::VAR && x.ttag() == EXPR::DBL); Value *u = codegen(x); Value *p = e.builder.CreateBitCast(u, DblExprPtrTy, "dblexpr"); - Value *v = e.CreateLoadGEP(p, Zero, One, "dblval"); + Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "dblval"); // collect the temporary, it's not needed any more call("pure_freenew", u); return v; @@ -2745,7 +2751,7 @@ verify_tag(u, EXPR::DBL); // get the value Value *p = e.builder.CreateBitCast(u, DblExprPtrTy, "dblexpr"); - Value *v = e.CreateLoadGEP(p, Zero, One, "dblval"); + Value *v = e.CreateLoadGEP(p, Zero, ValFldIndex, "dblval"); // collect the temporary, it's not needed any more call("pure_freenew", u); return v; @@ -4067,11 +4073,11 @@ Value *cmpv; if (t.tag == EXPR::INT) { Value *pv = f.builder.CreateBitCast(x, IntExprPtrTy, "intexpr"); - Value *iv = f.CreateLoadGEP(pv, Zero, One, "intval"); + Value *iv = f.CreateLoadGEP(pv, Zero, ValFldIndex, "intval"); cmpv = f.builder.CreateICmpEQ(iv, SInt(t.i), "cmp"); } else { Value *pv = f.builder.CreateBitCast(x, DblExprPtrTy, "dblexpr"); - Value *dv = f.CreateLoadGEP(pv, Zero, One, "dblval"); + Value *dv = f.CreateLoadGEP(pv, Zero, ValFldIndex, "dblval"); cmpv = f.builder.CreateFCmpOEQ(dv, Dbl(t.d), "cmp"); } f.builder.CreateCondBr(cmpv, matchedbb, failedbb); @@ -4331,11 +4337,11 @@ Value *cmpv; if (tag == EXPR::INT) { Value *pv = f.builder.CreateBitCast(x, IntExprPtrTy, "intexpr"); - Value *iv = f.CreateLoadGEP(pv, Zero, One, "intval"); + Value *iv = f.CreateLoadGEP(pv, Zero, ValFldIndex, "intval"); cmpv = f.builder.CreateICmpEQ(iv, SInt(l->t->i), "cmp"); } else { Value *pv = f.builder.CreateBitCast(x, DblExprPtrTy, "dblexpr"); - Value *dv = f.CreateLoadGEP(pv, Zero, One, "dblval"); + Value *dv = f.CreateLoadGEP(pv, Zero, ValFldIndex, "dblval"); cmpv = f.builder.CreateFCmpOEQ(dv, Dbl(l->t->d), "cmp"); } f.builder.CreateCondBr(cmpv, okbb, trynextbb); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 08:50:28
|
Revision: 15 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=15&view=rev Author: agraef Date: 2008-05-01 01:50:27 -0700 (Thu, 01 May 2008) Log Message: ----------- More OSX compatibility fixes. Modified Paths: -------------- pure/trunk/runtime.cc Modified: pure/trunk/runtime.cc =================================================================== --- pure/trunk/runtime.cc 2008-05-01 08:49:49 UTC (rev 14) +++ pure/trunk/runtime.cc 2008-05-01 08:50:27 UTC (rev 15) @@ -1398,11 +1398,13 @@ interp.defn("GLOB_NOSORT", pure_int(GLOB_NOSORT)); interp.defn("GLOB_NOCHECK", pure_int(GLOB_NOCHECK)); interp.defn("GLOB_NOESCAPE", pure_int(GLOB_NOESCAPE)); +#ifndef __APPLE__ interp.defn("GLOB_PERIOD", pure_int(GLOB_PERIOD)); + interp.defn("GLOB_ONLYDIR", pure_int(GLOB_ONLYDIR)); +#endif interp.defn("GLOB_BRACE", pure_int(GLOB_BRACE)); interp.defn("GLOB_NOMAGIC", pure_int(GLOB_NOMAGIC)); interp.defn("GLOB_TILDE", pure_int(GLOB_TILDE)); - interp.defn("GLOB_ONLYDIR", pure_int(GLOB_ONLYDIR)); // regex stuff interp.defn("REG_SIZE", pure_int(sizeof(regex_t))); // not in POSIX interp.defn("REG_EXTENDED", pure_int(REG_EXTENDED)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 08:49:42
|
Revision: 14 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=14&view=rev Author: agraef Date: 2008-05-01 01:49:49 -0700 (Thu, 01 May 2008) Log Message: ----------- Updated ChangeLog. Modified Paths: -------------- pure/trunk/ChangeLog Modified: pure/trunk/ChangeLog =================================================================== --- pure/trunk/ChangeLog 2008-05-01 08:48:54 UTC (rev 13) +++ pure/trunk/ChangeLog 2008-05-01 08:49:49 UTC (rev 14) @@ -1,3 +1,11 @@ +2008-05-01 Albert Graef <Dr....@t-...> + + * Makefile: g++ shouldn't be hardcoded, use $(CXX) instead. + Reported by Ryan Schmidt. + + * runtime.cc (pure_sys_vars): More OSX compatibility fixes. + Reported by Ryan Schmidt. + 2008-04-30 Albert Graef <Dr....@t-...> * interpreter.cc: Fix a compilation error (STL bug: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 08:48:48
|
Revision: 13 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=13&view=rev Author: agraef Date: 2008-05-01 01:48:54 -0700 (Thu, 01 May 2008) Log Message: ----------- g++ shouldn't be hardcoded, use $(CXX) instead. Modified Paths: -------------- pure/trunk/Makefile Modified: pure/trunk/Makefile =================================================================== --- pure/trunk/Makefile 2008-05-01 06:55:24 UTC (rev 12) +++ pure/trunk/Makefile 2008-05-01 08:48:54 UTC (rev 13) @@ -92,10 +92,10 @@ all: pure pure: $(OBJECT) - g++ -o $@ -rdynamic $(OBJECT) $(LIBS) + $(CXX) -o $@ -rdynamic $(OBJECT) $(LIBS) pure.o: pure.cc - g++ $(CXXFLAGS) -DVERSION='"$(version)"' -DPURELIB='"$(libdir)"' -c -o $@ $< + $(CXX) $(CXXFLAGS) -DVERSION='"$(version)"' -DPURELIB='"$(libdir)"' -c -o $@ $< lexer.cc: lexer.ll flex -o lexer.cc $< This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 06:55:17
|
Revision: 12 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=12&view=rev Author: agraef Date: 2008-04-30 23:55:24 -0700 (Wed, 30 Apr 2008) Log Message: ----------- Added regression reported by Chris Double. Added Paths: ----------- pure/trunk/test/test7.pure Added: pure/trunk/test/test7.pure =================================================================== --- pure/trunk/test/test7.pure (rev 0) +++ pure/trunk/test/test7.pure 2008-05-01 06:55:24 UTC (rev 12) @@ -0,0 +1,2 @@ +let y = (\a b -> a+b); +y 1 5; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ag...@us...> - 2008-05-01 06:52:39
|
Revision: 11 http://pure-lang.svn.sourceforge.net/pure-lang/?rev=11&view=rev Author: agraef Date: 2008-04-30 23:52:46 -0700 (Wed, 30 Apr 2008) Log Message: ----------- Added regressions reported by Tim Haynes. Added Paths: ----------- pure/trunk/test/test5.pure pure/trunk/test/test6.pure Added: pure/trunk/test/test5.pure =================================================================== --- pure/trunk/test/test5.pure (rev 0) +++ pure/trunk/test/test5.pure 2008-05-01 06:52:46 UTC (rev 11) @@ -0,0 +1,4 @@ +fact 0 = 1; +fact n = n * fact (n-1); +fact 4; + Added: pure/trunk/test/test6.pure =================================================================== --- pure/trunk/test/test6.pure (rev 0) +++ pure/trunk/test/test6.pure 2008-05-01 06:52:46 UTC (rev 11) @@ -0,0 +1,3 @@ +fact n = 1 if n==0; + = n * fact (n-1) otherwise; +fact 4; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |