diff options
author | Eduardo Julian | 2018-04-27 19:46:44 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-27 19:46:44 -0400 |
commit | f8d6348b3fec0c55768ebcd8dba446949b8a4ef7 (patch) | |
tree | 26aa0a2cc6309cfc6cba5b23d6a68f68934e40a4 /new-luxc/source/luxc/lang/translation/php/statement.jvm.lux | |
parent | fac2fa47c11db08596c890290bae09bf57a27089 (diff) |
- WIP: - Initial PHP back-end implementation.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/php/statement.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/php/statement.jvm.lux | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux new file mode 100644 index 000000000..592e579cf --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/php/statement.jvm.lux @@ -0,0 +1,48 @@ +(.module: + lux + (lux (control [monad #+ do]) + [macro] + (data text/format)) + (luxc (lang [".L" module] + (host ["_" php #+ Expression Statement]))) + [//] + (// [".T" runtime] + [".T" reference] + [".T" eval])) + +(def: #export (translate-def name expressionT expressionO metaV) + (-> Text Type Expression Code (Meta Unit)) + (do macro.Monad<Meta> + [current-module macro.current-module-name + #let [def-ident [current-module name]]] + (case (macro.get-symbol-ann (ident-for #.alias) metaV) + (#.Some real-def) + (do @ + [[realT realA realV] (macro.find-def real-def) + _ (moduleL.define def-ident [realT metaV realV])] + (wrap [])) + + _ + (do @ + [#let [def-name (referenceT.global def-ident)] + _ (//.save (_.set! def-name expressionO)) + expressionV (evalT.eval def-name) + _ (moduleL.define def-ident [expressionT metaV expressionV]) + _ (if (macro.type? metaV) + (case (macro.declared-tags metaV) + #.Nil + (wrap []) + + tags + (moduleL.declare-tags tags (macro.export? metaV) (:! Type expressionV))) + (wrap [])) + #let [_ (log! (format "DEF " (%ident def-ident)))]] + (wrap [])) + ))) + +(def: #export (translate-program programO) + (-> Expression (Meta Statement)) + (macro.fail "translate-program NOT IMPLEMENTED YET") + ## (hostT.save (format "var " (referenceT.variable +0) " = " runtimeT.lux//program-args "();" + ## "(" programO ")(null);")) + ) |