aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEduardo Julian2015-03-22 00:59:50 -0400
committerEduardo Julian2015-03-22 00:59:50 -0400
commita2cb7fba2b90cac1d40b409484ad8a0e8d189fd3 (patch)
tree3e1c17f443b2ea1b16db73e33e40e2fc09c3fee4 /src
parent6c5c857412c55aa1e015625afa6cdf163dea159b (diff)
- Added code-cursors (file-name, line-number, column-number) as metadata on lexer nodes & parser nodes.
Diffstat (limited to '')
-rw-r--r--src/lux/analyser.clj371
-rw-r--r--src/lux/analyser/case.clj24
-rw-r--r--src/lux/analyser/host.clj20
-rw-r--r--src/lux/analyser/lux.clj2
-rw-r--r--src/lux/base.clj51
-rw-r--r--src/lux/compiler/case.clj22
-rw-r--r--src/lux/host.clj6
-rw-r--r--src/lux/lexer.clj65
-rw-r--r--src/lux/macro.clj32
-rw-r--r--src/lux/parser.clj63
10 files changed, 359 insertions, 297 deletions
diff --git a/src/lux/analyser.clj b/src/lux/analyser.clj
index 30f829ee7..751e41923 100644
--- a/src/lux/analyser.clj
+++ b/src/lux/analyser.clj
@@ -14,378 +14,423 @@
;; [Utils]
(defn ^:private parse-handler [[catch+ finally+] token]
(matchv ::M/objects [token]
- [["Form" ["Cons" [["Symbol" [_ "jvm-catch"]]
- ["Cons" [["Symbol" [_ ?ex-class]]
- ["Cons" [["Symbol" [_ ?ex-arg]]
- ["Cons" [?catch-body
- ["Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["Form" ["Cons" [["lux;Meta" [_ ["Symbol" [_ "jvm-catch"]]]]
+ ["Cons" [["lux;Meta" [_ ["Symbol" [_ ?ex-class]]]]
+ ["Cons" [["lux;Meta" [_ ["Symbol" [_ ?ex-arg]]]]
+ ["Cons" [?catch-body
+ ["Nil" _]]]]]]]]]]]]]
[(concat catch+ (list [?ex-class ?ex-arg ?catch-body])) finally+]
- [["Form" ["Cons" [["Symbol" [_ "jvm-finally"]]
- ["Cons" [?finally-body
- ["Nil" _]]]]]]]
+ [["lux;Meta" [meta ["Form" ["Cons" [["lux;Meta" [_ ["Symbol" [_ "jvm-finally"]]]]
+ ["Cons" [?finally-body
+ ["Nil" _]]]]]]]]]
[catch+ ?finally-body]))
(defn ^:private analyse-basic-ast [analyse eval! token]
;; (prn 'analyse-basic-ast (aget token 0))
+ ;; (when (= "lux;Tag" (aget token 0))
+ ;; (prn 'analyse-basic-ast/tag (aget token 1)))
;; (prn 'analyse-basic-ast token (&/show-ast token))
(matchv ::M/objects [token]
;; Standard special forms
- [["lux;Bool" ?value]]
+ [["lux;Meta" [meta ["lux;Bool" ?value]]]]
(return (&/|list (&/V "Expression" (&/T (&/V "bool" ?value) (&/V "lux;TData" (&/T "java.lang.Boolean" (&/V "lux;Nil" nil)))))))
- [["lux;Int" ?value]]
+ [["lux;Meta" [meta ["lux;Int" ?value]]]]
(return (&/|list (&/V "Expression" (&/T (&/V "int" ?value) (&/V "lux;TData" (&/T "java.lang.Long" (&/V "lux;Nil" nil)))))))
- [["lux;Real" ?value]]
+ [["lux;Meta" [meta ["lux;Real" ?value]]]]
(return (&/|list (&/V "Expression" (&/T (&/V "real" ?value) (&/V "lux;TData" (&/T "java.lang.Double" (&/V "lux;Nil" nil)))))))
- [["lux;Char" ?value]]
+ [["lux;Meta" [meta ["lux;Char" ?value]]]]
(return (&/|list (&/V "Expression" (&/T (&/V "char" ?value) (&/V "lux;TData" (&/T "java.lang.Character" (&/V "lux;Nil" nil)))))))
- [["lux;Text" ?value]]
+ [["lux;Meta" [meta ["lux;Text" ?value]]]]
(return (&/|list (&/V "Expression" (&/T (&/V "text" ?value) (&/V "lux;TData" (&/T "java.lang.String" (&/V "lux;Nil" nil)))))))
- [["lux;Tuple" ?elems]]
+ [["lux;Meta" [meta ["lux;Tuple" ?elems]]]]
(&&lux/analyse-tuple analyse ?elems)
- [["lux;Record" ?elems]]
+ [["lux;Meta" [meta ["lux;Record" ?elems]]]]
(&&lux/analyse-record analyse ?elems)
- [["lux;Tag" [?module ?name]]]
+ [["lux;Meta" [meta ["lux;Tag" [?module ?name]]]]]
(let [tuple-type (&/V "lux;Tuple" (&/V "lux;Nil" nil))
?tag (str ?module ";" ?name)]
(return (&/|list (&/V "Expression" (&/T (&/V "variant" (&/T ?tag (&/V "Expression" (&/T (&/V "tuple" (&/|list)) tuple-type))))
(&/V "lux;TVariant" (&/V "lux;Cons" (&/T (&/T ?tag tuple-type) (&/V "lux;Nil" nil)))))))))
- [["lux;Symbol" [_ "jvm-null"]]]
+ [["lux;Meta" [meta ["lux;Symbol" [_ "jvm-null"]]]]]
(return (&/|list (&/V "Expression" (&/T (&/V "jvm-null" nil) (&/V "lux;TData" (&/T "null" (&/V "lux;Nil" nil)))))))
- [["lux;Symbol" ?ident]]
+ [["lux;Meta" [meta ["lux;Symbol" ?ident]]]]
(&&lux/analyse-ident analyse ?ident)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "case'"]]
- ["lux;Cons" [?variant ?branches]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "case'"]]]]
+ ["lux;Cons" [?variant ?branches]]]]]]]]
(&&lux/analyse-case analyse ?variant ?branches)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "lambda'"]]
- ["lux;Cons" [["lux;Symbol" [_ ?self]]
- ["lux;Cons" [["lux;Symbol" [_ ?arg]]
- ["lux;Cons" [?body
- ["lux;Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "lambda'"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?self]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?arg]]]]
+ ["lux;Cons" [?body
+ ["lux;Nil" _]]]]]]]]]]]]]
(&&lux/analyse-lambda analyse ?self ?arg ?body)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "get@'"]] ["lux;Cons" [["lux;Tag" ?slot] ["lux;Cons" [?record ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "get@'"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tag" ?slot]]]
+ ["lux;Cons" [?record ["lux;Nil" _]]]]]]]]]]]
(&&lux/analyse-get analyse ?slot ?record)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "set@'"]] ["lux;Cons" [["lux;Tag" ?slot] ["lux;Cons" [?value ["lux;Cons" [?record ["lux;Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "set@'"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tag" ?slot]]]
+ ["lux;Cons" [?value
+ ["lux;Cons" [?record
+ ["lux;Nil" _]]]]]]]]]]]]]
(&&lux/analyse-set analyse ?slot ?value ?record)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "def'"]] ["lux;Cons" [["lux;Symbol" [_ ?name]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
- (&&lux/analyse-def analyse ?name ?value)
-
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "declare-macro"]] ["lux;Cons" [["lux;Symbol" ?ident] ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "def'"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?name]]]]
+ ["lux;Cons" [?value
+ ["lux;Nil" _]]]]]]]]]]]
+ (do ;; (when (= "if" ?name)
+ ;; (prn "if" (&/show-ast ?value)))
+ (&&lux/analyse-def analyse ?name ?value))
+
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "declare-macro"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" ?ident]]]
+ ["lux;Nil" _]]]]]]]]]
(&&lux/analyse-declare-macro ?ident)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "import'"]] ["lux;Cons" [["lux;Text" ?path] ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "import'"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?path]]]
+ ["lux;Nil" _]]]]]]]]]
(&&lux/analyse-import analyse ?path)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ ":"]] ["lux;Cons" [?value ["lux;Cons" [?type ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ":"]]]]
+ ["lux;Cons" [?value
+ ["lux;Cons" [?type
+ ["lux;Nil" _]]]]]]]]]]]
(&&lux/analyse-check analyse eval! ?type ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "coerce"]] ["lux;Cons" [?type ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "coerce"]]]]
+ ["lux;Cons" [?type
+ ["lux;Cons" [?value
+ ["lux;Nil" _]]]]]]]]]]]
(&&lux/analyse-coerce analyse eval! ?type ?value)
;; Host special forms
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "exec"]] ?exprs]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "exec"]]]]
+ ?exprs]]]]]]
(&&host/analyse-exec analyse ?exprs)
;; Integer arithmetic
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-iadd"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-iadd"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-iadd analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-isub"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-isub"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-isub analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-imul"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-imul"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-imul analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-idiv"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-idiv"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-idiv analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-irem"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-irem"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-irem analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-ieq"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-ieq"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-ieq analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-ilt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-ilt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-ilt analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-igt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-igt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-igt analyse ?x ?y)
;; Long arithmetic
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-ladd"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-ladd"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-ladd analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lsub"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lsub"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lsub analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lmul"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lmul"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lmul analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-ldiv"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-ldiv"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-ldiv analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lrem"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lrem"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lrem analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-leq"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-leq"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-leq analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-llt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-llt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-llt analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lgt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lgt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lgt analyse ?x ?y)
;; Float arithmetic
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-fadd"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-fadd"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-fadd analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-fsub"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-fsub"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-fsub analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-fmul"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-fmul"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-fmul analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-fdiv"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-fdiv"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-fdiv analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-frem"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-frem"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-frem analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-feq"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-feq"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-feq analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-flt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-flt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-flt analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-fgt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-fgt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-fgt analyse ?x ?y)
;; Double arithmetic
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-dadd"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-dadd"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-dadd analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-dsub"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-dsub"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-dsub analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-dmul"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-dmul"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-dmul analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-ddiv"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-ddiv"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-ddiv analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-drem"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-drem"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-drem analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-deq"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-deq"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-deq analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-dlt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-dlt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-dlt analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-dgt"]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-dgt"]]]] ["lux;Cons" [?y ["lux;Cons" [?x ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-dgt analyse ?x ?y)
;; Objects
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-null?"]] ["lux;Cons" [?object ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-null?"]]]]
+ ["lux;Cons" [?object
+ ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-null? analyse ?object)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-new"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Tuple" ?classes]
- ["lux;Cons" [["lux;Tuple" ?args]
- ["lux;Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-new"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?classes]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?args]]]
+ ["lux;Nil" _]]]]]]]]]]]]]
(&&host/analyse-jvm-new analyse ?class ?classes ?args)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-getstatic"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?field]
- ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-getstatic"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?field]]]
+ ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-getstatic analyse ?class ?field)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-getfield"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?field]
- ["lux;Cons" [?object
- ["lux;Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-getfield"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?field]]]
+ ["lux;Cons" [?object
+ ["lux;Nil" _]]]]]]]]]]]]]
(&&host/analyse-jvm-getfield analyse ?class ?field ?object)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-putstatic"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?field]
- ["lux;Cons" [?value
- ["lux;Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-putstatic"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?field]]]
+ ["lux;Cons" [?value
+ ["lux;Nil" _]]]]]]]]]]]]]
(&&host/analyse-jvm-putstatic analyse ?class ?field ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-putfield"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?field]
- ["lux;Cons" [?object
- ["lux;Cons" [?value
- ["lux;Nil" _]]]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-putfield"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?field]]]
+ ["lux;Cons" [?object
+ ["lux;Cons" [?value
+ ["lux;Nil" _]]]]]]]]]]]]]]]
(&&host/analyse-jvm-putfield analyse ?class ?field ?object ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-invokestatic"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?method]
- ["lux;Cons" [["lux;Tuple" ?classes]
- ["lux;Cons" [["lux;Tuple" ?args]
- ["lux;Nil" _]]]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-invokestatic"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?method]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?classes]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?args]]]
+ ["lux;Nil" _]]]]]]]]]]]]]]]
(&&host/analyse-jvm-invokestatic analyse ?class ?method ?classes ?args)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-invokevirtual"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?method]
- ["lux;Cons" [["lux;Tuple" ?classes]
- ["lux;Cons" [?object
- ["lux;Cons" [["lux;Tuple" ?args]
- ["lux;Nil" _]]]]]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-invokevirtual"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?method]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?classes]]]
+ ["lux;Cons" [?object
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?args]]]
+ ["lux;Nil" _]]]]]]]]]]]]]]]]]
(&&host/analyse-jvm-invokevirtual analyse ?class ?method ?classes ?object ?args)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-invokeinterface"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?method]
- ["lux;Cons" [["lux;Tuple" ?classes]
- ["lux;Cons" [?object
- ["lux;Cons" [["lux;Tuple" ?args]
- ["lux;Nil" _]]]]]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-invokeinterface"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?method]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?classes]]]
+ ["lux;Cons" [?object
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?args]]]
+ ["lux;Nil" _]]]]]]]]]]]]]]]]]
(&&host/analyse-jvm-invokeinterface analyse ?class ?method ?classes ?object ?args)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-invokespecial"]]
- ["lux;Cons" [["lux;Symbol" [_ ?class]]
- ["lux;Cons" [["lux;Text" ?method]
- ["lux;Cons" [["lux;Tuple" ?classes]
- ["lux;Cons" [?object
- ["lux;Cons" [["lux;Tuple" ?args]
- ["lux;Nil" _]]]]]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-invokespecial"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Text" ?method]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?classes]]]
+ ["lux;Cons" [?object
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?args]]]
+ ["lux;Nil" _]]]]]]]]]]]]]]]]]
(&&host/analyse-jvm-invokespecial analyse ?class ?method ?classes ?object ?args)
;; Exceptions
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-try"]]
- ["lux;Cons" [?body
- ?handlers]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-try"]]]]
+ ["lux;Cons" [?body
+ ?handlers]]]]]]]]
(&&host/analyse-jvm-try analyse ?body (&/fold parse-handler [(list) nil] ?handlers))
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-throw"]]
- ["lux;Cons" [?ex
- ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-throw"]]]]
+ ["lux;Cons" [?ex
+ ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-throw analyse ?ex)
;; Syncronization/monitos
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-monitorenter"]]
- ["lux;Cons" [?monitor
- ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-monitorenter"]]]]
+ ["lux;Cons" [?monitor
+ ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-monitorenter analyse ?monitor)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-monitorexit"]]
- ["lux;Cons" [?monitor
- ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-monitorexit"]]]]
+ ["lux;Cons" [?monitor
+ ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-monitorexit analyse ?monitor)
;; Primitive conversions
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-d2f"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-d2f"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-d2f analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-d2i"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-d2i"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-d2i analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-d2l"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-d2l"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-d2l analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-f2d"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-f2d"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-f2d analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-f2i"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-f2i"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-f2i analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-f2l"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-f2l"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-f2l analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-i2b"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-i2b"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-i2b analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-i2c"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-i2c"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-i2c analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-i2d"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-i2d"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-i2d analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-i2f"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-i2f"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-i2f analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-i2l"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-i2l"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-i2l analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-i2s"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-i2s"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-i2s analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-l2d"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-l2d"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-l2d analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-l2f"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-l2f"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-l2f analyse ?value)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-l2i"]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-l2i"]]]] ["lux;Cons" [?value ["lux;Nil" _]]]]]]]]]
(&&host/analyse-jvm-l2i analyse ?value)
;; Bitwise operators
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-iand"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-iand"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-iand analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-ior"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-ior"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-ior analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-land"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-land"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-land analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lor"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lor"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lor analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lxor"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lxor"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lxor analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lshl"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lshl"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lshl analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lshr"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lshr"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lshr analyse ?x ?y)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-lushr"]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-lushr"]]]] ["lux;Cons" [?x ["lux;Cons" [?y ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-lushr analyse ?x ?y)
;; Arrays
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-new-array"]] ["lux;Cons" [["lux;Symbol" [_ ?class]] ["lux;Cons" [["lux;Int" ?length] ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-new-array"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Int" ?length]]]
+ ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-new-array analyse ?class ?length)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-aastore"]] ["lux;Cons" [?array ["lux;Cons" [["lux;Int" ?idx] ["lux;Cons" [?elem ["lux;Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-aastore"]]]]
+ ["lux;Cons" [?array
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Int" ?idx]]]
+ ["lux;Cons" [?elem
+ ["lux;Nil" _]]]]]]]]]]]]]
(&&host/analyse-jvm-aastore analyse ?array ?idx ?elem)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-aaload"]] ["lux;Cons" [?array ["lux;Cons" [["lux;Int" ?idx] ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-aaload"]]]]
+ ["lux;Cons" [?array
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Int" ?idx]]]
+ ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-aaload analyse ?array ?idx)
;; Classes & interfaces
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-class"]] ["lux;Cons" [["lux;Symbol" [_ ?name]] ["lux;Cons" [["lux;Symbol" [_ ?super-class]] ["lux;Cons" [["lux;Tuple" ?fields] ["lux;Nil" _]]]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-class"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?name]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?super-class]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?fields]]]
+ ["lux;Nil" _]]]]]]]]]]]]]
(&&host/analyse-jvm-class analyse ?name ?super-class ?fields)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-interface"]] ["lux;Cons" [["lux;Symbol" [_ ?name]] ?members]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-interface"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?name]]]]
+ ?members]]]]]]]]
(&&host/analyse-jvm-interface analyse ?name ?members)
;; Programs
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "jvm-program"]] ["lux;Cons" [["lux;Symbol" [_ ?args]] ["lux;Cons" [?body ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "jvm-program"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?args]]]]
+ ["lux;Cons" [?body
+ ["lux;Nil" _]]]]]]]]]]]
(&&host/analyse-jvm-program analyse ?args ?body)
[_]
@@ -395,7 +440,7 @@
(fn [token]
;; (prn 'analyse-ast token)
(matchv ::M/objects [token]
- [["lux;Form" ["lux;Cons" [["lux;Tag" [?module ?name]] ?values]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Tag" [?module ?name]]]] ?values]]]]]]
(exec [;; :let [_ (prn 'PRE-ASSERT)]
:let [?tag (str ?module ";" ?name)]
:let [_ (assert (= 1 (&/|length ?values)) (str "[Analyser Error] Can only tag 1 value: " (pr-str token)))]
@@ -404,7 +449,7 @@
=value-type (&&/expr-type =value)]
(return (&/|list (&/V "Expression" (&/T (&/V "variant" (&/T ?tag =value)) (&/V "lux;TVariant" (&/V "lux;Cons" (&/T (&/T ?tag =value-type) (&/V "lux;Nil" nil)))))))))
- [["lux;Form" ["lux;Cons" [?fn ?args]]]]
+ [["lux;Meta" [meta ["lux;Form" ["lux;Cons" [?fn ?args]]]]]]
(fn [state]
;; (prn '(&/show-ast ?fn) (&/show-ast ?fn))
(matchv ::M/objects [((&&/analyse-1 (analyse-ast eval!) ?fn) state)]
diff --git a/src/lux/analyser/case.clj b/src/lux/analyser/case.clj
index 38ec41e64..f6a0b2cc8 100644
--- a/src/lux/analyser/case.clj
+++ b/src/lux/analyser/case.clj
@@ -10,13 +10,13 @@
;; [Resources]
(defn locals [member]
(matchv ::M/objects [member]
- [["lux;Symbol" [_ ?name]]]
+ [["lux;Meta" [_ ["lux;Symbol" [_ ?name]]]]]
(&/|list ?name)
- [["lux;Tuple" ?submembers]]
+ [["lux;Meta" [_ ["lux;Tuple" ?submembers]]]]
(&/flat-map locals ?submembers)
- [["lux;Form" ["lux;Cons" [["lux;Tag" _] ?submembers]]]]
+ [["lux;Meta" [_ ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Tag" _]]] ?submembers]]]]]]
(&/flat-map locals ?submembers)
[_]
@@ -25,12 +25,12 @@
(defn analyse-branch [analyse max-registers bindings+body]
(|let [[bindings body] bindings+body]
(do ;; (prn 'analyse-branch max-registers (&/->seq bindings) body)
- (&/fold (fn [body* name]
- (&&/with-var
- (fn [=var]
- (&env/with-local name =var body*))))
- (&/fold (fn [body* _]
- (&env/with-local "" &type/+dont-care+ body*))
- (&&/analyse-1 analyse body)
- (&/|range (- max-registers (&/|length bindings))))
- (&/|reverse bindings)))))
+ (&/fold (fn [body* name]
+ (&&/with-var
+ (fn [=var]
+ (&env/with-local name =var body*))))
+ (&/fold (fn [body* _]
+ (&env/with-local "" &type/+dont-care+ body*))
+ (&&/analyse-1 analyse body)
+ (&/|range (- max-registers (&/|length bindings))))
+ (&/|reverse bindings)))))
diff --git a/src/lux/analyser/host.clj b/src/lux/analyser/host.clj
index 999c5df8a..b8963f73f 100644
--- a/src/lux/analyser/host.clj
+++ b/src/lux/analyser/host.clj
@@ -12,7 +12,7 @@
;; [Utils]
(defn ^:private extract-ident [ident]
(matchv ::M/objects [ident]
- [["lux;Symbol" [_ ?ident]]]
+ [["lux;Meta" [_ ["lux;Symbol" [_ ?ident]]]]]
(return ?ident)
[_]
@@ -155,7 +155,9 @@
(defn analyse-jvm-class [analyse ?name ?super-class ?fields]
(exec [?fields (&/map% (fn [?field]
(matchv ::M/objects [?field]
- [["lux;Tuple" ["lux;Cons" [["lux;Symbol" ?class] ["lux;Cons" [["lux;Symbol" ?field-name] ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [_ ["lux;Tuple" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" ?class]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" ?field-name]]]
+ ["lux;Nil" _]]]]]]]]]
(return [?class ?field-name])
[_]
@@ -172,13 +174,13 @@
(exec [=members (&/map% (fn [member]
;; (prn 'analyse-jvm-interface (&/show-ast member))
(matchv ::M/objects [member]
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ ":"]]
- ["lux;Cons" [["lux;Symbol" [_ ?member-name]]
- ["lux;Cons" [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "->"]]
- ["lux;Cons" [["lux;Tuple" ?inputs]
- ["lux;Cons" [["lux;Symbol" [_ ?output]]
- ["lux;Nil" _]]]]]]]]
- ["lux;Nil" _]]]]]]]]]
+ [["lux;Meta" [_ ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ":"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?member-name]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "->"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Tuple" ?inputs]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?output]]]]
+ ["lux;Nil" _]]]]]]]]]]
+ ["lux;Nil" _]]]]]]]]]]]
(do ;; (prn 'analyse-jvm-interface ?member-name ?inputs ?output)
(exec [?inputs (&/map% extract-ident ?inputs)]
(return [?member-name [?inputs ?output]])))
diff --git a/src/lux/analyser/lux.clj b/src/lux/analyser/lux.clj
index f8555f9d1..e6dd0d1d0 100644
--- a/src/lux/analyser/lux.clj
+++ b/src/lux/analyser/lux.clj
@@ -46,7 +46,6 @@
(fail* (str "[Analyser Error] Unresolved identifier: " ident*)))))
(defn analyse-ident [analyse ident]
- ;; (prn 'analyse-ident ident)
(|let [[?module ?name] ident]
(do ;; (prn 'analyse-ident ?module ?name)
(exec [module-name &/get-module-name]
@@ -167,6 +166,7 @@
=case-type))))))
(defn analyse-lambda [analyse ?self ?arg ?body]
+ ;; (prn 'analyse-lambda ?self ?arg ?body)
(exec [=lambda-type* &type/fresh-lambda]
(matchv ::M/objects [=lambda-type*]
[["lux;TLambda" [=arg =return]]]
diff --git a/src/lux/base.clj b/src/lux/base.clj
index 80340ec30..7d0c03c86 100644
--- a/src/lux/base.clj
+++ b/src/lux/base.clj
@@ -177,6 +177,7 @@
(V "lux;Cons" (T x (|++ xs* ys)))))
(defn |map [f xs]
+ ;; (prn '|map (aget xs 0))
(matchv ::M/objects [xs]
[["lux;Nil" _]]
xs
@@ -322,7 +323,7 @@
xs))
(defn show-table [table]
- (prn 'show-table (aget table 0))
+ ;; (prn 'show-table (aget table 0))
(str "{{"
(->> table
(|map (fn [kv] (|let [[k v] kv] (str k " = ???"))))
@@ -424,11 +425,12 @@
(try-all% (|list (exec [output-h step
output-t (exhaust% step)]
(return (|cons output-h output-t)))
- (return (|list))
- (exec [? source-consumed?]
- (if ?
- (return (|list))
- (exhaust% step))))))
+ ;; (return (|list))
+ ;; (exec [? source-consumed?]
+ ;; (if ?
+ ;; (return (|list))
+ ;; (exhaust% step)))
+ )))
(defn ^:private normalize-char [char]
(case char
@@ -601,14 +603,14 @@
body)]
(body* (if local?
(update$ "lux;local-envs" #(|cons (update$ "lux;inner-closures" inc (|head %))
- (|tail %))
+ (|tail %))
state)
(update$ "lux;global-env" #(matchv ::M/objects [%]
- [["lux;Some" global-env]]
- (V "lux;Some" (update$ "lux;inner-closures" inc global-env))
+ [["lux;Some" global-env]]
+ (V "lux;Some" (update$ "lux;inner-closures" inc global-env))
- [_]
- %)
+ [_]
+ %)
state)))))
)))
@@ -632,31 +634,40 @@
(defn show-ast [ast]
;; (prn 'show-ast (aget ast 0))
+ ;; (prn 'show-ast (aget ast 1 1 0))
+ ;; (cond (= "lux;Meta" (aget ast 1 1 0))
+ ;; (prn 'EXTRA 'show-ast (aget ast 1 1 1 1 0))
+
+ ;; (= "lux;Symbol" (aget ast 1 1 0))
+ ;; (prn 'EXTRA 'show-ast (aget ast 1 1 1 1))
+
+ ;; :else
+ ;; nil)
(matchv ::M/objects [ast]
- [["lux;Bool" ?value]]
+ [["lux;Meta" [_ ["lux;Bool" ?value]]]]
(pr-str ?value)
- [["lux;Int" ?value]]
+ [["lux;Meta" [_ ["lux;Int" ?value]]]]
(pr-str ?value)
- [["lux;Real" ?value]]
+ [["lux;Meta" [_ ["lux;Real" ?value]]]]
(pr-str ?value)
- [["lux;Char" ?value]]
+ [["lux;Meta" [_ ["lux;Char" ?value]]]]
(pr-str ?value)
- [["lux;Text" ?value]]
+ [["lux;Meta" [_ ["lux;Text" ?value]]]]
(str "\"" ?value "\"")
- [["lux;Tag" [?module ?tag]]]
+ [["lux;Meta" [_ ["lux;Tag" [?module ?tag]]]]]
(str "#" ?module ";" ?tag)
- [["lux;Symbol" [?module ?ident]]]
+ [["lux;Meta" [_ ["lux;Symbol" [?module ?ident]]]]]
(str ?module ";" ?ident)
- [["lux;Tuple" ?elems]]
+ [["lux;Meta" [_ ["lux;Tuple" ?elems]]]]
(str "[" (->> ?elems (|map show-ast) (|interpose " ") (fold str "")) "]")
- [["lux;Form" ?elems]]
+ [["lux;Meta" [_ ["lux;Form" ?elems]]]]
(str "(" (->> ?elems (|map show-ast) (|interpose " ") (fold str "")) ")")
))
diff --git a/src/lux/compiler/case.clj b/src/lux/compiler/case.clj
index 10f451587..afa446df0 100644
--- a/src/lux/compiler/case.clj
+++ b/src/lux/compiler/case.clj
@@ -20,25 +20,25 @@
;; (prn '->match token)
;; (prn '->match (aget token 0))
(matchv ::M/objects [token]
- [["lux;Symbol" [_ ?name]]]
+ [["lux;Meta" [_ ["lux;Symbol" [_ ?name]]]]]
(&/T (inc register) (&/V "Pattern" (&/T $body (&/V "StoreMatch" register))))
- [["lux;Bool" ?value]]
+ [["lux;Meta" [_ ["lux;Bool" ?value]]]]
(&/T register (&/V "Pattern" (&/T $body (&/V "BoolMatch" ?value))))
- [["lux;Int" ?value]]
+ [["lux;Meta" [_ ["lux;Int" ?value]]]]
(&/T register (&/V "Pattern" (&/T $body (&/V "IntMatch" ?value))))
- [["lux;Real" ?value]]
+ [["lux;Meta" [_ ["lux;Real" ?value]]]]
(&/T register (&/V "Pattern" (&/T $body (&/V "RealMatch" ?value))))
- [["lux;Char" ?value]]
+ [["lux;Meta" [_ ["lux;Char" ?value]]]]
(&/T register (&/V "Pattern" (&/T $body (&/V "CharMatch" ?value))))
- [["lux;Text" ?value]]
+ [["lux;Meta" [_ ["lux;Text" ?value]]]]
(&/T register (&/V "Pattern" (&/T $body (&/V "TextMatch" ?value))))
- [["lux;Tuple" ?members]]
+ [["lux;Meta" [_ ["lux;Tuple" ?members]]]]
(|let [[register* =members] (&/fold (fn [register+=members member]
;; (prn 'register+=members (alength register+=members))
(|let [[_register =members] register+=members
@@ -50,13 +50,13 @@
?members)]
(&/T register* (&/V "Pattern" (&/T $body (&/V "TupleMatch" (&/|reverse =members))))))
- [["lux;Tag" [?module ?name]]]
+ [["lux;Meta" [_ ["lux;Tag" [?module ?name]]]]]
(|let [?tag (str ?module ";" ?name)]
(&/T register (&/V "Pattern" (&/T $body (&/V "VariantMatch" (&/T ?tag (&/V "Pattern" (&/T $body (&/V "TupleMatch" (&/|list))))))))))
- [["lux;Form" ["lux;Cons" [["lux;Tag" [?module ?name]]
- ["lux;Cons" [?value
- ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [_ ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Tag" [?module ?name]]]]
+ ["lux;Cons" [?value
+ ["lux;Nil" _]]]]]]]]]
(|let [?tag (str ?module ";" ?name)
[register* =value] (->match $body register ?value)]
(&/T register* (&/V "Pattern" (&/T $body (&/V "VariantMatch" (&/T ?tag =value))))))
diff --git a/src/lux/host.clj b/src/lux/host.clj
index 8954792d3..6432a6d5f 100644
--- a/src/lux/host.clj
+++ b/src/lux/host.clj
@@ -98,10 +98,12 @@
(defn extract-jvm-param [token]
(matchv ::M/objects [token]
- [["lux;Symbol" [_ ?ident]]]
+ [["lux;Meta" [_ ["lux;Symbol" [_ ?ident]]]]]
(full-class-name ?ident)
- [["lux;Form" ["lux;Cons" [["lux;Symbol" [_ "Array"]] ["lux;Cons" [["lux;Symbol" [_ ?inner]] ["lux;Nil" _]]]]]]]
+ [["lux;Meta" [_ ["lux;Form" ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ "Array"]]]]
+ ["lux;Cons" [["lux;Meta" [_ ["lux;Symbol" [_ ?inner]]]]
+ ["lux;Nil" _]]]]]]]]]
(exec [=inner (full-class-name ?inner)]
(return (str "[L" (->class =inner) ";")))
diff --git a/src/lux/lexer.clj b/src/lux/lexer.clj
index 38a6a40d7..f53a01665 100644
--- a/src/lux/lexer.clj
+++ b/src/lux/lexer.clj
@@ -29,35 +29,35 @@
;; [Lexers]
(def ^:private lex-white-space
- (exec [[_ [_ white-space]] (&reader/read-regex #"^(\s+)")]
- (return (&/V "White_Space" white-space))))
+ (exec [[_ [meta white-space]] (&reader/read-regex #"^(\s+)")]
+ (return (&/V "lux;Meta" (&/T meta (&/V "White_Space" white-space))))))
(def ^:private lex-single-line-comment
- (exec [_ (&reader/read-text "##")
+ (exec [[_ [meta _]] (&reader/read-text "##")
[_ [_ comment]] (&reader/read-regex #"^([^\n]*)")
_ (&reader/read-regex #"^(\n?)")]
- (return (&/V "Comment" comment))))
+ (return (&/V "lux;Meta" (&/T meta (&/V "Comment" comment))))))
-(def ^:private lex-multi-line-comment
+(defn ^:private lex-multi-line-comment [___]
(exec [_ (&reader/read-text "#(")
- comment (&/try-all% (&/|list (exec [[_ [_ comment]] (&reader/read-regex #"(?is)^((?!#\().)*?(?=\)#)")]
- (return comment))
- (exec [[_ [_ pre]] (&reader/read-regex #"(?is)^(.+?(?=#\())")
- [_ inner] lex-multi-line-comment
- [_ [_ post]] (&reader/read-regex #"(?is)^(.+?(?=\)#))")]
- (return (str pre "#(" inner ")#" post)))))
+ [meta comment] (&/try-all% (&/|list (exec [[_ [meta comment]] (&reader/read-regex #"(?is)^((?!#\().)*?(?=\)#)")]
+ (return comment))
+ (exec [[_ [meta pre]] (&reader/read-regex #"(?is)^(.+?(?=#\())")
+ [_ inner] (lex-multi-line-comment nil)
+ [_ [_ post]] (&reader/read-regex #"(?is)^(.+?(?=\)#))")]
+ (return (str pre "#(" inner ")#" post)))))
_ (&reader/read-text ")#")]
- (return (&/V "Comment" comment))))
+ (return (&/V "lux;Meta" (&/T meta (&/V "Comment" comment))))))
(def ^:private lex-comment
(&/try-all% (&/|list lex-single-line-comment
- ;; lex-multi-line-comment
+ ;; (lex-multi-line-comment nil)
)))
(do-template [<name> <tag> <regex>]
(def <name>
- (exec [[_ [_ token]] (&reader/read-regex <regex>)]
- (return (&/V <tag> token))))
+ (exec [[_ [meta token]] (&reader/read-regex <regex>)]
+ (return (&/V "lux;Meta" (&/T meta (&/V <tag> token))))))
^:private lex-bool "Bool" #"^(true|false)"
^:private lex-int "Int" #"^-?(0|[1-9][0-9]*)"
@@ -65,52 +65,53 @@
)
(def ^:private lex-char
- (exec [_ (&reader/read-text "#\"")
+ (exec [[_ [meta _]] (&reader/read-text "#\"")
token (&/try-all% (&/|list (exec [escaped (&reader/read-regex #"^(\\.)")]
(escape-char escaped))
(exec [[_ [_ char]] (&reader/read-regex #"^(.)")]
(return char))))
_ (&reader/read-text "\"")]
- (return (&/V "Char" token))))
+ (return (&/V "lux;Meta" (&/T meta (&/V "Char" token))))))
(def ^:private lex-text
- (exec [_ (&reader/read-text "\"")
+ (exec [[_ [meta _]] (&reader/read-text "\"")
token (lex-text-body nil)
_ (&reader/read-text "\"")]
- (return (&/V "Text" token))))
+ (return (&/V "lux;Meta" (&/T meta (&/V "Text" token))))))
(def ^:private lex-ident
- (&/try-all% (&/|list (exec [_ (&reader/read-text ";")
+ (&/try-all% (&/|list (exec [[_ [meta _]] (&reader/read-text ";")
[_ [_ token]] (&reader/read-regex +ident-re+)
module-name &/get-module-name]
- (return (&/T module-name token)))
- (exec [[_ [_ token]] (&reader/read-regex +ident-re+)]
+ (return (&/V "lux;Meta" (&/T meta (&/T module-name token)))))
+ (exec [[_ [metma token]] (&reader/read-regex +ident-re+)]
(&/try-all% (&/|list (exec [_ (&reader/read-text ";")
[_ [_ local-token]] (&reader/read-regex +ident-re+)]
(&/try-all% (&/|list (exec [unaliased (&def/unalias-module token)]
- (return (&/T unaliased local-token)))
+ (return (&/V "lux;Meta" (&/T meta (&/T unaliased local-token)))))
(exec [? (&def/module-exists? token)]
(if ?
- (return (&/T token local-token))
+ (return (&/V "lux;Meta" (&/T meta (&/T token local-token))))
(fail (str "[Lexer Error] Unknown module: " token))))
)))
(exec [module-name &/get-module-name]
- (return (&/T module-name token))))))
+ (return (&/V "lux;Meta" (&/T meta (&/T module-name token)))))
+ )))
)))
(def ^:private lex-symbol
- (exec [ident lex-ident]
- (return (&/V "Symbol" ident))))
+ (exec [[_ [meta ident]] lex-ident]
+ (return (&/V "lux;Meta" (&/T meta (&/V "Symbol" ident))))))
(def ^:private lex-tag
- (exec [_ (&reader/read-text "#")
- ident lex-ident]
- (return (&/V "Tag" ident))))
+ (exec [[_ [meta _]] (&reader/read-text "#")
+ [_ [_ ident]] lex-ident]
+ (return (&/V "lux;Meta" (&/T meta (&/V "Tag" ident))))))
(do-template [<name> <text> <tag>]
(def <name>
- (exec [_ (&reader/read-text <text>)]
- (return (&/V <tag> nil))))
+ (exec [[_ [meta _]] (&reader/read-text <text>)]
+ (return (&/V "lux;Meta" (&/T meta (&/V <tag> nil))))))
^:private lex-open-paren "(" "Open_Paren"
^:private lex-close-paren ")" "Close_Paren"
diff --git a/src/lux/macro.clj b/src/lux/macro.clj
index 7b612cbbb..d5fee9eab 100644
--- a/src/lux/macro.clj
+++ b/src/lux/macro.clj
@@ -7,21 +7,19 @@
(defn expand [loader macro-class tokens]
(fn [state]
;; (prn 'expand macro-class tokens state)
- ;; (let [expansion (-> (.loadClass loader macro-class)
- ;; (.getField "_datum")
- ;; (.get nil)
- ;; (.apply tokens)
- ;; (.apply state))]
- ;; (matchv ::M/objects [expansion]
- ;; [["lux;Right" [state* nodes]]]
- ;; (doseq [node (&/->seq nodes)]
- ;; (prn 'expansion macro-class (&/show-ast node)))
+ (let [expansion (-> (.loadClass loader macro-class)
+ (.getField "_datum")
+ (.get nil)
+ (.apply tokens)
+ (.apply state))]
+ ;; (if (or (= "lux$_BQUOTE_" macro-class)
+ ;; (= "lux$if" macro-class))
+ ;; (matchv ::M/objects [expansion]
+ ;; [["lux;Right" [state* nodes]]]
+ ;; (doseq [node (&/->seq nodes)]
+ ;; (prn 'expansion macro-class (&/show-ast node)))
- ;; [_]
- ;; nil)
- ;; expansion)
- (-> (.loadClass loader macro-class)
- (.getField "_datum")
- (.get nil)
- (.apply tokens)
- (.apply state))))
+ ;; [_]
+ ;; nil))
+ expansion)
+ ))
diff --git a/src/lux/parser.clj b/src/lux/parser.clj
index 1b0a44f91..71fca764a 100644
--- a/src/lux/parser.clj
+++ b/src/lux/parser.clj
@@ -11,8 +11,8 @@
(exec [elems (&/repeat% parse)
token &lexer/lex]
(matchv ::M/objects [token]
- [[<close-token> _]]
- (return (&/|list (&/V <tag> (&/fold &/|++ (&/|list) elems))))
+ [["lux;Meta" [meta [<close-token> _]]]]
+ (return (&/V <tag> (&/fold &/|++ (&/|list) elems)))
[_]
(fail (str "[Parser Error] Unbalanced " <description> ".")))))
@@ -26,13 +26,13 @@
token &lexer/lex
:let [elems (&/fold &/|++ (&/|list) elems*)]]
(matchv ::M/objects [token]
- [["Close_Brace" _]]
- (fail (str "[Parser Error] Unbalanced braces."))
-
- [_]
+ [["lux;Meta" [meta ["Close_Brace" _]]]]
(if (even? (&/|length elems))
- (return (&/|list (&/V "lux;Record" (&/|as-pairs elems))))
- (fail (str "[Parser Error] Records must have an even number of elements."))))))
+ (return (&/V "lux;Record" (&/|as-pairs elems)))
+ (fail (str "[Parser Error] Records must have an even number of elements.")))
+
+ [_]
+ (fail (str "[Parser Error] Unbalanced braces.")))))
;; [Interface]
(def parse
@@ -41,41 +41,44 @@
;; :let [_ (prn 'parse (aget token 0))]
]
(matchv ::M/objects [token]
- [["White_Space" _]]
+ [["lux;Meta" [meta ["White_Space" _]]]]
(return (&/|list))
- [["Comment" _]]
+ [["lux;Meta" [meta ["Comment" _]]]]
(return (&/|list))
- [["Bool" ?value]]
- (return (&/|list (&/V "lux;Bool" (Boolean/parseBoolean ?value))))
+ [["lux;Meta" [meta ["Bool" ?value]]]]
+ (return (&/|list (&/V "lux;Meta" (&/T meta (&/V "lux;Bool" (Boolean/parseBoolean ?value))))))
- [["Int" ?value]]
- (return (&/|list (&/V "lux;Int" (Integer/parseInt ?value))))
+ [["lux;Meta" [meta ["Int" ?value]]]]
+ (return (&/|list (&/V "lux;Meta" (&/T meta (&/V "lux;Int" (Integer/parseInt ?value))))))
- [["Real" ?value]]
- (return (&/|list (&/V "lux;Real" (Float/parseFloat ?value))))
+ [["lux;Meta" [meta ["Real" ?value]]]]
+ (return (&/|list (&/V "lux;Meta" (&/T meta (&/V "lux;Real" (Float/parseFloat ?value))))))
- [["Char" ?value]]
- (return (&/|list (&/V "lux;Char" (.charAt ?value 0))))
+ [["lux;Meta" [meta ["Char" ?value]]]]
+ (return (&/|list (&/V "lux;Meta" (&/T meta (&/V "lux;Char" (.charAt ?value 0))))))
- [["Text" ?value]]
- (return (&/|list (&/V "lux;Text" ?value)))
+ [["lux;Meta" [meta ["Text" ?value]]]]
+ (return (&/|list (&/V "lux;Meta" (&/T meta (&/V "lux;Text" ?value)))))
- [["Symbol" ?ident]]
- (return (&/|list (&/V "lux;Symbol" ?ident)))
+ [["lux;Meta" [meta ["Symbol" ?ident]]]]
+ (return (&/|list (&/V "lux;Meta" (&/T meta (&/V "lux;Symbol" ?ident)))))
- [["Tag" ?ident]]
- (return (&/|list (&/V "lux;Tag" ?ident)))
+ [["lux;Meta" [meta ["Tag" ?ident]]]]
+ (return (&/|list (&/V "lux;Meta" (&/T meta (&/V "lux;Tag" ?ident)))))
- [["Open_Paren" _]]
- (parse-form parse)
+ [["lux;Meta" [meta ["Open_Paren" _]]]]
+ (exec [syntax (parse-form parse)]
+ (return (&/|list (&/V "lux;Meta" (&/T meta syntax)))))
- [["Open_Bracket" _]]
- (parse-tuple parse)
+ [["lux;Meta" [meta ["Open_Bracket" _]]]]
+ (exec [syntax (parse-tuple parse)]
+ (return (&/|list (&/V "lux;Meta" (&/T meta syntax)))))
- [["Open_Brace" _]]
- (parse-record parse)
+ [["lux;Meta" [meta ["Open_Brace" _]]]]
+ (exec [syntax (parse-record parse)]
+ (return (&/|list (&/V "lux;Meta" (&/T meta syntax)))))
[_]
(fail "[Parser Error] Unknown lexer token.")