aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/statement.jvm.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/statement.jvm.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/statement.jvm.lux87
1 files changed, 42 insertions, 45 deletions
diff --git a/new-luxc/source/luxc/lang/translation/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/statement.jvm.lux
index df7e26741..a734adfed 100644
--- a/new-luxc/source/luxc/lang/translation/statement.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/statement.jvm.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (control monad
["ex" exception #+ exception:])
@@ -10,84 +10,81 @@
[macro]
[host])
(luxc ["&" lang]
- ["&;" io]
+ ["&." io]
(lang (host ["$" jvm]
(jvm ["$t" type]
["$d" def]
["$i" inst]))
- ["&;" scope]
- ["&;" module]
- (translation [";T" eval]
- [";T" common]))))
+ ["&." scope]
+ ["&." module]
+ (translation [".T" eval]
+ [".T" common]))))
(exception: #export Invalid-Definition-Value)
(exception: #export Cannot-Evaluate-Definition)
-(host;import java.lang.Object
- (toString [] String))
-
-(host;import java.lang.reflect.Field
+(host.import java/lang/reflect/Field
(get [#? Object] #try #? Object))
-(host;import (java.lang.Class c)
+(host.import (java/lang/Class c)
(getField [String] #try Field))
(def: #export (translate-def def-name valueT valueI metaI metaV)
- (-> Text Type $;Inst $;Inst Code (Meta Unit))
- (do macro;Monad<Meta>
- [current-module macro;current-module-name
+ (-> Text Type $.Inst $.Inst Code (Meta Unit))
+ (do macro.Monad<Meta>
+ [current-module macro.current-module-name
#let [def-ident [current-module def-name]]]
- (case (macro;get-symbol-ann (ident-for #;alias) metaV)
- (#;Some real-def)
+ (case (macro.get-symbol-ann (ident-for #.alias) metaV)
+ (#.Some real-def)
(do @
- [[realT realA realV] (macro;find-def real-def)
- _ (&module;define def-ident [realT metaV realV])]
+ [[realT realA realV] (macro.find-def real-def)
+ _ (&module.define def-ident [realT metaV realV])]
(wrap []))
_
(do @
- [#let [normal-name (format (&;normalize-name def-name) (%n (text/hash def-name)))
+ [#let [normal-name (format (&.normalize-name def-name) (%n (text/hash def-name)))
bytecode-name (format current-module "/" normal-name)
- class-name (format (text;replace-all "/" "." current-module) "." normal-name)
- bytecode ($d;class #$;V1.6
- #$;Public $;finalC
+ class-name (format (text.replace-all "/" "." current-module) "." normal-name)
+ bytecode ($d.class #$.V1_6
+ #$.Public $.finalC
bytecode-name
(list) ["java.lang.Object" (list)]
(list)
- (|>. ($d;field #$;Public ($;++F $;finalF $;staticF) commonT;value-field commonT;$Object)
- ($d;method #$;Public $;staticM "<clinit>" ($t;method (list) #;None (list))
- (|>. valueI
- ($i;PUTSTATIC bytecode-name commonT;value-field commonT;$Object)
- $i;RETURN))))]
- _ (commonT;store-class class-name bytecode)
- class (commonT;load-class class-name)
+ (|>> ($d.field #$.Public ($.++F $.finalF $.staticF) commonT.value-field commonT.$Object)
+ ($d.method #$.Public $.staticM "<clinit>" ($t.method (list) #.None (list))
+ (|>> valueI
+ ($i.PUTSTATIC bytecode-name commonT.value-field commonT.$Object)
+ $i.RETURN))))]
+ _ (commonT.store-class class-name bytecode)
+ class (commonT.load-class class-name)
valueV (: (Meta Top)
- (case (do e;Monad<Error>
- [field (Class.getField [commonT;value-field] class)]
- (Field.get [#;None] field))
- (#e;Success #;None)
- (&;throw Invalid-Definition-Value (%ident def-ident))
+ (case (do e.Monad<Error>
+ [field (Class::getField [commonT.value-field] class)]
+ (Field::get [#.None] field))
+ (#e.Success #.None)
+ (&.throw Invalid-Definition-Value (%ident def-ident))
- (#e;Success (#;Some valueV))
+ (#e.Success (#.Some valueV))
(wrap valueV)
- (#e;Error error)
- (&;throw Cannot-Evaluate-Definition
+ (#e.Error error)
+ (&.throw Cannot-Evaluate-Definition
(format "Definition: " (%ident def-ident) "\n"
"Error:\n"
error))))
- _ (&module;define def-ident [valueT metaV valueV])
- _ (if (macro;type? metaV)
- (case (macro;declared-tags metaV)
- #;Nil
+ _ (&module.define def-ident [valueT metaV valueV])
+ _ (if (macro.type? metaV)
+ (case (macro.declared-tags metaV)
+ #.Nil
(wrap [])
tags
- (&module;declare-tags tags (macro;export? metaV) (:! Type valueV)))
+ (&module.declare-tags tags (macro.export? metaV) (:! Type valueV)))
(wrap []))
#let [_ (log! (format "DEF " (%ident def-ident)))]]
- (commonT;record-artifact (format bytecode-name ".class") bytecode)))))
+ (commonT.record-artifact (format bytecode-name ".class") bytecode)))))
(def: #export (translate-program program-args programI)
- (-> Text $;Inst (Meta Unit))
- (&;fail "\"lux program\" is unimplemented."))
+ (-> Text $.Inst (Meta Unit))
+ (&.fail "\"lux program\" is unimplemented."))