aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/python
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/python')
-rw-r--r--new-luxc/source/luxc/lang/translation/python/case.jvm.lux5
-rw-r--r--new-luxc/source/luxc/lang/translation/python/eval.jvm.lux21
-rw-r--r--new-luxc/source/luxc/lang/translation/python/expression.jvm.lux9
-rw-r--r--new-luxc/source/luxc/lang/translation/python/procedure.jvm.lux3
-rw-r--r--new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux32
-rw-r--r--new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux4
6 files changed, 43 insertions, 31 deletions
diff --git a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
index 2218c1994..2668ae9f2 100644
--- a/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/case.jvm.lux
@@ -34,7 +34,7 @@
(Meta Expression))
(do macro.Monad<Meta>
[valueO (translate valueS)]
- (wrap (list/fold (function [[idx tail?] source]
+ (wrap (list/fold (function (_ [idx tail?] source)
(let [method (if tail?
runtimeT.product//right
runtimeT.product//left)]
@@ -85,7 +85,8 @@
(def: $temp (python.var "temp"))
-(exception: #export Unrecognized-Path)
+(exception: #export (Unrecognized-Path {message Text})
+ message)
(def: $alt_error (python.var "alt_error"))
diff --git a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
index bc6e1a342..164d088df 100644
--- a/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/eval.jvm.lux
@@ -11,6 +11,16 @@
(lang (host [python #+ Expression Statement])))
[//])
+(do-template [<name>]
+ [(exception: #export (<name> {message Text})
+ message)]
+
+ [Not-A-Variant]
+ [Unknown-Kind-Of-Host-Object]
+ [Null-Has-No-Lux-Representation]
+ [Cannot-Evaluate]
+ )
+
(host.import java/lang/Object
(toString [] String)
(getClass [] (Class Object)))
@@ -57,8 +67,6 @@
(-> PyObject Text)
(|>> (PyObject::getType []) (PyType::getName []) (:! Text)))
-(exception: #export Not-A-Variant)
-
(def: tag-field (PyString::new [//.variant-tag-field]))
(def: flag-field (PyString::new [//.variant-flag-field]))
(def: value-field (PyString::new [//.variant-value-field]))
@@ -89,9 +97,6 @@
_
(ex.throw Not-A-Variant (Object::toString [] host-object))))
-(exception: #export Unknown-Kind-Of-Host-Object)
-(exception: #export Null-Has-No-Lux-Representation)
-
(def: (lux-object host-object)
(-> PyObject (Error Top))
(case (python-type host-object)
@@ -119,11 +124,9 @@
type
(ex.throw Unknown-Kind-Of-Host-Object (format type " " (Object::toString [] host-object)))))
-(exception: #export Cannot-Evaluate)
-
(def: #export (eval code)
(-> Expression (Meta Top))
- (function [compiler]
+ (function (_ compiler)
(let [interpreter (|> compiler (get@ #.host) (:! //.Host) (get@ #//.interpreter))]
(case (interpreter code)
(#e.Error error)
@@ -136,7 +139,7 @@
(case (lux-object output)
(#e.Success parsed-output)
(exec ## (log! (format "eval #e.Success\n"
- ## "<< " (python.expression code)))
+ ## "<< " (python.expression code)))
(#e.Success [compiler parsed-output]))
(#e.Error error)
diff --git a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux
index 6a7497c22..d153d8953 100644
--- a/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/expression.jvm.lux
@@ -21,8 +21,13 @@
[".T" case]
[".T" procedure]))
-(exception: #export Invalid-Function-Syntax)
-(exception: #export Unrecognized-Synthesis)
+(do-template [<name>]
+ [(exception: #export (<name> {message Text})
+ message)]
+
+ [Invalid-Function-Syntax]
+ [Unrecognized-Synthesis]
+ )
(def: #export (translate synthesis)
(-> ls.Synthesis (Meta Expression))
diff --git a/new-luxc/source/luxc/lang/translation/python/procedure.jvm.lux b/new-luxc/source/luxc/lang/translation/python/procedure.jvm.lux
index a46778503..699c0c000 100644
--- a/new-luxc/source/luxc/lang/translation/python/procedure.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/procedure.jvm.lux
@@ -12,7 +12,8 @@
(/ ["/." common]
["/." host]))
-(exception: #export Unknown-Procedure)
+(exception: #export (Unknown-Procedure {message Text})
+ message)
(def: procedures
/common.Bundle
diff --git a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
index 6205d22a7..badca2d74 100644
--- a/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/procedure/common.jvm.lux
@@ -52,7 +52,7 @@
(-> Text Bundle Bundle)
(|> bundle
dict.entries
- (list/map (function [[key val]] [(format prefix " " key) val]))
+ (list/map (function (_ [key val]) [(format prefix " " key) val]))
(dict.from-list text.Hash<Text>)))
(def: (wrong-arity proc expected actual)
@@ -62,19 +62,19 @@
" Actual: " (|> actual nat-to-int %i)))
(syntax: (arity: [name s.local-symbol] [arity s.nat])
- (with-gensyms [g!proc g!name g!translate g!inputs]
+ (with-gensyms [g!_ g!proc g!name g!translate g!inputs]
(do @
[g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))]
(wrap (list (` (def: #export ((~ (code.local-symbol name)) (~ g!proc))
(-> (-> (..Vector (~ (code.nat arity)) Expression) Expression)
(-> Text ..Proc))
- (function [(~ g!name)]
- (function [(~ g!translate) (~ g!inputs)]
+ (function ((~ g!_) (~ g!name))
+ (function ((~ g!_) (~ g!translate) (~ g!inputs))
(case (~ g!inputs)
(^ (list (~+ g!input+)))
(do macro.Monad<Meta>
[(~+ (|> g!input+
- (list/map (function [g!input]
+ (list/map (function (_ g!input)
(list g!input (` ((~ g!translate) (~ g!input))))))
list.concat))]
((~' wrap) ((~ g!proc) [(~+ g!input+)])))
@@ -89,8 +89,8 @@
(def: #export (variadic proc)
(-> Variadic (-> Text Proc))
- (function [proc-name]
- (function [translate inputsS]
+ (function (_ proc-name)
+ (function (_ translate inputsS)
(do macro.Monad<Meta>
[inputsI (monad.map @ translate inputsS)]
(wrap (proc inputsI))))))
@@ -113,7 +113,9 @@
Unary
valueO)
-(exception: #export Wrong-Syntax)
+(exception: #export (Wrong-Syntax {message Text})
+ message)
+
(def: #export (wrong-syntax procedure args)
(-> Text (List ls.Synthesis) Text)
(format "Procedure: " procedure "\n"
@@ -121,8 +123,8 @@
(def: lux//loop
(-> Text Proc)
- (function [proc-name]
- (function [translate inputsS]
+ (function (_ proc-name)
+ (function (_ translate inputsS)
(case (s.run inputsS ($_ p.seq s.nat (s.tuple (p.many s.any)) s.any))
(#e.Success [offset initsS+ bodyS])
(loopT.translate-loop translate offset initsS+ bodyS)
@@ -133,8 +135,8 @@
(def: lux//recur
(-> Text Proc)
- (function [proc-name]
- (function [translate inputsS]
+ (function (_ proc-name)
+ (function (_ translate inputsS)
(loopT.translate-recur translate inputsS))))
(def: lux-procs
@@ -328,12 +330,12 @@
(def: (apply1 func)
(-> Expression (-> Expression Expression))
- (function [value]
+ (function (_ value)
(python.apply (list value) func)))
(def: (send0 method)
(-> Text (-> Expression Expression))
- (function [object]
+ (function (_ object)
(python.send (list) method object)))
(do-template [<name> <divisor>]
@@ -489,7 +491,7 @@
(install "log" (unary runtimeT.io//log!))
(install "error" (unary runtimeT.io//throw!))
(install "exit" (unary runtimeT.io//exit!))
- (install "current-time" (nullary (function [_]
+ (install "current-time" (nullary (function (_ _)
(runtimeT.io//current-time! runtimeT.unit)))))))
## [[Atoms]]
diff --git a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
index e8f564745..6319c2121 100644
--- a/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/python/runtime.jvm.lux
@@ -81,7 +81,7 @@
_
(` (let [(~+ (|> (list.zip2 argsC+ argsLC+)
- (list/map (function [[left right]]
+ (list/map (function (_ [left right])
(list left (` (@@ (~ right))))))
list/join))]
(python.def! (~ $runtime)
@@ -91,7 +91,7 @@
(syntax: (with-vars [vars (s.tuple (p.many s.local-symbol))]
body)
(wrap (list (` (let [(~+ (|> vars
- (list/map (function [var]
+ (list/map (function (_ var)
(list (code.local-symbol var)
(` (python.var (~ (code.text (lang.normalize-name var))))))))
list/join))]