From 37b94ba49afb272c63ec66e42d56b8fba35cea9f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 15 Nov 2017 23:40:46 -0400 Subject: - Moved "luxc/lang/host/macro" to "luxc/lang/macro". --- new-luxc/source/luxc/lang/analysis/expression.lux | 4 +-- new-luxc/source/luxc/lang/host/macro.lux | 37 ----------------------- new-luxc/source/luxc/lang/macro.lux | 37 +++++++++++++++++++++++ new-luxc/source/luxc/lang/translation.lux | 6 ++-- 4 files changed, 42 insertions(+), 42 deletions(-) delete mode 100644 new-luxc/source/luxc/lang/host/macro.lux create mode 100644 new-luxc/source/luxc/lang/macro.lux (limited to 'new-luxc/source/luxc') diff --git a/new-luxc/source/luxc/lang/analysis/expression.lux b/new-luxc/source/luxc/lang/analysis/expression.lux index 5157848ec..5d38f7626 100644 --- a/new-luxc/source/luxc/lang/analysis/expression.lux +++ b/new-luxc/source/luxc/lang/analysis/expression.lux @@ -12,7 +12,7 @@ (luxc ["&" lang] (lang ["&;" module] [";L" host] - (host [";H" macro]) + [";L" macro] ["la" analysis] (translation [";T" common]))) (.. [";A" common] @@ -92,7 +92,7 @@ (if (macro;macro? def-anns) (do @ [expansion (function [compiler] - (case (macroH;expand (:! Macro def-value) args compiler) + (case (macroL;expand (:! Macro def-value) args compiler) (#e;Success [compiler' output]) (#e;Success [compiler' output]) diff --git a/new-luxc/source/luxc/lang/host/macro.lux b/new-luxc/source/luxc/lang/host/macro.lux deleted file mode 100644 index d557b6750..000000000 --- a/new-luxc/source/luxc/lang/host/macro.lux +++ /dev/null @@ -1,37 +0,0 @@ -(;module: - lux - (lux (control [monad #+ do]) - (data ["e" error]) - [macro] - [host]) - (luxc (lang (translation [";T" common]))) - [..]) - -(for {"JVM" (as-is (host;import java.lang.reflect.Method - (invoke [Object (Array Object)] #try Object)) - (host;import (java.lang.Class c) - (getMethod [String (Array (Class Object))] #try Method)) - (host;import java.lang.Object - (getClass [] (Class Object)) - (toString [] String)) - (def: _object-class (Class Object) (host;class-for Object)) - (def: _apply-args - (Array (Class Object)) - (|> (host;array (Class Object) +2) - (host;array-write +0 _object-class) - (host;array-write +1 _object-class))) - (def: #export (expand macro inputs) - (-> Macro (List Code) (Meta (List Code))) - (do macro;Monad - [class (commonT;load-class ..;function-class)] - (function [compiler] - (do e;Monad - [apply-method (Class.getMethod ["apply" _apply-args] class) - output (Method.invoke [(:! Object macro) - (|> (host;array Object +2) - (host;array-write +0 (:! Object inputs)) - (host;array-write +1 (:! Object compiler)))] - apply-method)] - (:! (e;Error [Compiler (List Code)]) - output)))))) - }) diff --git a/new-luxc/source/luxc/lang/macro.lux b/new-luxc/source/luxc/lang/macro.lux new file mode 100644 index 000000000..4885e21db --- /dev/null +++ b/new-luxc/source/luxc/lang/macro.lux @@ -0,0 +1,37 @@ +(;module: + lux + (lux (control [monad #+ do]) + (data ["e" error]) + [macro] + [host]) + (luxc (lang [";L" host] + (translation [";T" common])))) + +(for {"JVM" (as-is (host;import java.lang.reflect.Method + (invoke [Object (Array Object)] #try Object)) + (host;import (java.lang.Class c) + (getMethod [String (Array (Class Object))] #try Method)) + (host;import java.lang.Object + (getClass [] (Class Object)) + (toString [] String)) + (def: _object-class (Class Object) (host;class-for Object)) + (def: _apply-args + (Array (Class Object)) + (|> (host;array (Class Object) +2) + (host;array-write +0 _object-class) + (host;array-write +1 _object-class))) + (def: #export (expand macro inputs) + (-> Macro (List Code) (Meta (List Code))) + (do macro;Monad + [class (commonT;load-class hostL;function-class)] + (function [compiler] + (do e;Monad + [apply-method (Class.getMethod ["apply" _apply-args] class) + output (Method.invoke [(:! Object macro) + (|> (host;array Object +2) + (host;array-write +0 (:! Object inputs)) + (host;array-write +1 (:! Object compiler)))] + apply-method)] + (:! (e;Error [Compiler (List Code)]) + output)))))) + }) diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 9b59e5341..dd84ad024 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -17,8 +17,8 @@ ["&;" io] (lang [";L" module] [";L" host] - (host [";H" macro] - ["$" jvm]) + [";L" macro] + (host ["$" jvm]) (analysis [";A" expression] [";A" common]) (synthesis [";S" expression]) @@ -90,7 +90,7 @@ (if (macro;macro? def-anns) (do @ [expansion (function [compiler] - (case (macroH;expand (:! Macro def-value) args compiler) + (case (macroL;expand (:! Macro def-value) args compiler) (#e;Success [compiler' output]) (#e;Success [compiler' output]) -- cgit v1.2.3