From 33f318849c0702b254eccf79f6ef9b7015e4537b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 8 Mar 2015 04:42:09 -0400 Subject: - In lux.lux, fixed a bug in the "list" macro that rendered it unusable. - Fixed a bug when compiling lambda instantiation (the bug had to do with compiling the env variables passed to the closure). - Fixed a bug in the lexer wherein the backquote (`) wasn't being recognized. --- src/lux/compiler/lambda.clj | 4 ++-- src/lux/lexer.clj | 2 +- src/lux/macro.clj | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lux/compiler/lambda.clj b/src/lux/compiler/lambda.clj index 5358519d9..004f09743 100644 --- a/src/lux/compiler/lambda.clj +++ b/src/lux/compiler/lambda.clj @@ -83,13 +83,13 @@ (.visitTypeInsn Opcodes/NEW lambda-class) (.visitInsn Opcodes/DUP))] _ (->> closed-over - (sort #(match [%1 %2] + (sort #(match [(second %1) (second %2)] [[::&a/Expression [::&a/captured _ ?cid1 _] _] [::&a/Expression [::&a/captured _ ?cid2 _] _]] (< ?cid1 ?cid2))) (map-m (fn [[?name ?captured]] (match ?captured - [::&a/Expression [::&a/captured _ ?captured-id ?source] _] + [::&a/Expression [::&a/captured _ _ ?source] _] (compile ?source))))) :let [_ (.visitMethodInsn *writer* Opcodes/INVOKESPECIAL lambda-class "" init-signature)]] (return nil))) diff --git a/src/lux/lexer.clj b/src/lux/lexer.clj index 4ad36f669..fe899691c 100644 --- a/src/lux/lexer.clj +++ b/src/lux/lexer.clj @@ -41,7 +41,7 @@ (return (str prefix unescaped postfix))) (lex-regex #"(?s)^([^\"\\]*)")])) -(def ^:private +ident-re+ #"^([a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|':\~\?][0-9a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|':\~\?]*)(;[0-9a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|':\~\?]+)?") +(def ^:private +ident-re+ #"^([a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|'`:\~\?][0-9a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|'`:\~\?]*)(;[0-9a-zA-Z\-\+\_\=!@$%^&*<>\.,/\\\|'`:\~\?]+)?") ;; [Lexers] (def ^:private lex-white-space diff --git a/src/lux/macro.clj b/src/lux/macro.clj index 7f1e7116b..071f95691 100644 --- a/src/lux/macro.clj +++ b/src/lux/macro.clj @@ -38,6 +38,7 @@ )) (defn ^:private ->clojure+ [->clojure xs] + ;; (prn '->clojure+ (aget xs 0)) (case (aget xs 0) "Nil" (list) "Cons" (let [tuple2 (aget xs 1)] @@ -46,6 +47,9 @@ )) (defn ^:private ->clojure [x] + ;; (if (= "Tag" (aget x 0)) + ;; (println " ->clojure" (pr-str (aget x 0)) (aget x 1)) + ;; (println " ->clojure" (pr-str (aget x 0)))) (case (aget x 0) "Bool" [::&parser/Bool (aget x 1)] "Int" [::&parser/Int (aget x 1)] -- cgit v1.2.3