diff options
author | Eduardo Julian | 2018-05-01 00:40:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-05-01 00:40:01 -0400 |
commit | 4b7d81c1e0449adc031ece6299fe4d0a09f66347 (patch) | |
tree | 0e57526f8cc68b19e7714ccecce09f2ed367883a /new-luxc/source/luxc/lang/translation/php/procedure.jvm.lux | |
parent | f8d6348b3fec0c55768ebcd8dba446949b8a4ef7 (diff) |
- WIP: - Initial PHP back-end implementation [missing procedures].
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/php/procedure.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/php/procedure.jvm.lux | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/php/procedure.jvm.lux b/new-luxc/source/luxc/lang/translation/php/procedure.jvm.lux new file mode 100644 index 000000000..9748167ca --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/php/procedure.jvm.lux @@ -0,0 +1,30 @@ +(.module: + lux + (lux (control [monad #+ do] + ["ex" exception #+ exception:]) + (data [maybe] + [text] + text/format + (coll [dict]))) + (luxc ["&" lang] + (lang ["ls" synthesis] + (host ["_" php #+ Expression Statement]))) + [//] + (/ ["/." common] + ["/." host])) + +(exception: #export (Unknown-Procedure {message Text}) + message) + +(def: procedures + /common.Bundle + (|> /common.procedures + (dict.merge /host.procedures))) + +(def: #export (translate-procedure translate name args) + (-> (-> ls.Synthesis (Meta Expression)) Text (List ls.Synthesis) + (Meta Expression)) + (<| (maybe.default (&.throw Unknown-Procedure (%t name))) + (do maybe.Monad<Maybe> + [proc (dict.get name procedures)] + (wrap (proc translate args))))) |