summaryrefslogtreecommitdiff
path: root/modules/language/python/compile.scm
diff options
context:
space:
mode:
Diffstat (limited to 'modules/language/python/compile.scm')
-rw-r--r--modules/language/python/compile.scm31
1 files changed, 21 insertions, 10 deletions
diff --git a/modules/language/python/compile.scm b/modules/language/python/compile.scm
index 80f523c..dad7656 100644
--- a/modules/language/python/compile.scm
+++ b/modules/language/python/compile.scm
@@ -14,6 +14,7 @@
#:use-module (language python bytes)
#:use-module (language python number)
#:use-module (language python def)
+ #:use-module (language python module)
#:use-module ((language python with) #:select ())
#:use-module (ice-9 pretty-print)
#:export (comp))
@@ -27,7 +28,6 @@
(define-inlinable (F x) `(@@ (language python for) ,x))
(define-inlinable (E x) `(@@ (language python exceptions) ,x))
(define-inlinable (L x) `(@@ (language python list) ,x))
-(define-inlinable (A x) `(@@ (language python array) ,x))
(define-inlinable (S x) `(@@ (language python string) ,x))
(define-inlinable (B x) `(@@ (language python bytes) ,x))
(define-inlinable (Se x) `(@@ (language python set) ,x))
@@ -822,9 +822,19 @@
((_ (#:from (() . nm) . #f))
`(use-modules (language python module ,@(map (lambda (nm) (exp vs nm))
nm))))
+ ((_ (#:from (() . nm) . l))
+ `(use-modules ((language python module ,@(map (lambda (nm) (exp vs nm))
+ nm))
+ #:select ,(map (lambda (x)
+ (match x
+ ((a . #f)
+ (exp vs a))
+ ((a . b)
+ (cons (exp vs a) (exp vs b)))))
+ l))))
+
((_ (#:name ((ids ...) . as)) ...)
- (pk x)
`(begin
,@(map
(lambda (ids as)
@@ -836,20 +846,21 @@
((#:test (#:power #f ,as ())))
(#:assign
((#:verb
- ((@ (language python module) Module)
- ',(reverse (append '(language python module) path))
- ',(reverse path)))))))
-
+ ((@ (language python module) import)
+ ((@ (language python module) Module)
+ ',(reverse (append '(language python module) path))
+ ',(reverse path))
+ ,(exp vs as)))))))
(exp
vs
`(#:expr-stmt
((#:test (#:power #f ,(car ids) ())))
(#:assign
((#:verb
- (((@ (language python module) import)
- ((@ (language python module) Module)
- ',(append '(language python module) path))
- ,(exp vs (car ids))))))))))))
+ ((@ (language python module) import)
+ ((@ (language python module) Module)
+ ',(append '(language python module) path))
+ ,(exp vs (car ids)))))))))))
ids as))))
(#:for