perl.cvs.parrot
[Top] [All Lists]

[svn:parrot] r24824 - in trunk/languages/eclectus: . t

Subject: [svn:parrot] r24824 - in trunk/languages/eclectus: . t
From:
Date: Sun, 13 Jan 2008 05:06:25 -0800 PST
Newsgroups: perl.cvs.parrot

Author: bernhard
Date: Sun Jan 13 05:06:24 2008
New Revision: 24824

Modified:
   trunk/languages/eclectus/compiler.scm
   trunk/languages/eclectus/t/local_variables.t

Log:
[Eclectus]
Improve support for 'let*


Modified: trunk/languages/eclectus/compiler.scm
==============================================================================
--- trunk/languages/eclectus/compiler.scm       (original)
+++ trunk/languages/eclectus/compiler.scm       Sun Jan 13 05:06:24 2008
@@ -509,7 +509,15 @@
           [(eqv? (car tree) 'not) 
            (quasiquote (if (unquote (preprocess (cadr tree))) #f #t))]
           [(eqv? (car tree) 'let*) 
-           (cons 'let (preprocess (cdr tree)))]
+           (preprocess
+             (if (null? (cadr tree))
+                 (cons 'let (cdr tree))
+                 (list
+                   'let
+                   (list (caadr tree))
+                   (append
+                     (list 'let* (cdadr tree))
+                     (cddr tree)))))]
           [else
            (map preprocess tree)]))) 
 

Modified: trunk/languages/eclectus/t/local_variables.t
==============================================================================
--- trunk/languages/eclectus/t/local_variables.t        (original)
+++ trunk/languages/eclectus/t/local_variables.t        Sun Jan 13 05:06:24 2008
@@ -14,7 +14,13 @@
   [(let (($var_a 13) ($var_b 21)) (fx> $var_b $var_a))     => "#t\n"]     
   [(let ((var-a 13) (var-b 22))   (fx+ var-a var-b))       => "35\n"]     
   [(let ((var-a2 13) (var-b3 23))   (fx+ var-a2 var-b3))   => "36\n"]     
-  [(let* () 23)                                            => "23\n"]     
+  [(let* () 22)                                            => "22\n"]     
+  [(let* () (fx+ 22 1))                                    => "23\n"]     
+  [(let* ((arg1 24)) arg1)                                 => "24\n"]     
+  [(let* ((arg1 24)(arg2 25)) arg2)                        => "25\n"]     
+  [(let* ((arg1 12)(arg2 14)) (fx+ arg1 arg2))             => "26\n"]     
+  [(let* ((arg1 12)(arg2 (fx+ 14 1))) (fx+ arg1 arg2))     => "27\n"]     
+  [(let* ((arg1 12)(arg2 (fx+ arg1 4))) (fx+ arg1 arg2))   => "28\n"]     
 )
 
 (load "compiler.scm")

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:parrot] r24824 - in trunk/languages/eclectus: . t, bernhard <=