aboutsummaryrefslogtreecommitdiff
path: root/src/lang
diff options
context:
space:
mode:
authorEduardo Julian2014-12-13 00:54:09 -0400
committerEduardo Julian2014-12-13 00:54:09 -0400
commit4a79a6c9cb2ca3e52b259cff987901f400c8ebc3 (patch)
tree5b4c26b5226ec2caa4ce613675dbffdc53cd2247 /src/lang
parent8f5cd3917fd3a94ae99710a614dce9028f9afad8 (diff)
+ Removed "module" special form.
+ Fixed a bug that was preventing multi-line comments from being truly multi-line.
Diffstat (limited to '')
-rw-r--r--src/lang.clj14
-rw-r--r--src/lang/analyser.clj8
-rw-r--r--src/lang/compiler.clj10
-rw-r--r--src/lang/lexer.clj8
4 files changed, 15 insertions, 25 deletions
diff --git a/src/lang.clj b/src/lang.clj
index 83862bb2f..d8b65afe6 100644
--- a/src/lang.clj
+++ b/src/lang.clj
@@ -51,20 +51,20 @@
(write-file "test2.class" class-data))
;; TODO: Define functions as classes inheriting Function.
+ ;; TODO: Allow importing Java classes.
+ ;; TODO: Allow using other modules.
;; TODO: Add tuples.
+ ;; TODO: Add thunks.
;; TODO: Add pattern-matching.
+ ;; TODO: Add Java-interop.
;; TODO: Do tail-call optimization.
;; TODO: Add macros.
+ ;; TODO: Add signatures & structures OR type-classes.
;; TODO: Add type-level computations.
;; TODO: Add interpreter.
- ;; TODO: Add Java-interop.
- ;; TODO: Add signatures & structures OR type-classes.
- ;; TODO: Allow importing Java classes.
- ;; TODO: Allow using other modules.
- ;; TODO: Add thunks.
;; TODO: Re-implement compiler in language.
- ;; TODO:
- ;; TODO:
+ ;; TODO: Add all the missing literal types.
+ ;; TODO: Allow strings to have escape characters.
;; TODO:
;; jar cvf test2.jar test2 test2.class
diff --git a/src/lang/analyser.clj b/src/lang/analyser.clj
index 811cc93ea..c40fccffb 100644
--- a/src/lang/analyser.clj
+++ b/src/lang/analyser.clj
@@ -173,11 +173,6 @@
(return (annotated [::def [?name args] =value] ::&type/nothing))))
))
-(defanalyser analyse-module
- [::&parser/module]
- (exec [name module-name]
- (return (annotated [::module name] ::&type/nothing))))
-
(def ^:private analyse-form
(try-all-m [analyse-boolean
analyse-string
@@ -191,8 +186,7 @@
analyse-let
analyse-defclass
analyse-definterface
- analyse-def
- analyse-module]))
+ analyse-def]))
;; [Interface]
(defn analyse [module-name tokens]
diff --git a/src/lang/compiler.clj b/src/lang/compiler.clj
index 8b73720c4..a8d38842a 100644
--- a/src/lang/compiler.clj
+++ b/src/lang/compiler.clj
@@ -168,11 +168,6 @@
(.visitEnd))))
))
-(defcompiler ^:private compile-module
- [::&analyser/module ?name]
- (.visit *writer* Opcodes/V1_5 (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER)
- (->class ?name) nil "java/lang/Object" nil))
-
(defcompiler ^:private compile-defclass
[::&analyser/defclass [?package ?name] ?members]
(let [parent-dir (->package ?package)
@@ -236,7 +231,6 @@
compile-if
compile-let
compile-def
- compile-module
compile-defclass
compile-definterface
compile-variant]]
@@ -248,7 +242,9 @@
;; [Interface]
(defn compile [class-name inputs]
(prn 'inputs inputs)
- (let [=class (new ClassWriter ClassWriter/COMPUTE_MAXS)
+ (let [=class (doto (new ClassWriter ClassWriter/COMPUTE_MAXS)
+ (.visit Opcodes/V1_5 (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER)
+ (->class class-name) nil "java/lang/Object" nil))
;; (doto (new ClassWriter ClassWriter/COMPUTE_MAXS)
;; (.visit Opcodes/V1_5 (+ Opcodes/ACC_PUBLIC Opcodes/ACC_SUPER)
;; "output" nil "java/lang/Object" nil))
diff --git a/src/lang/lexer.clj b/src/lang/lexer.clj
index caaa15604..c88f54d57 100644
--- a/src/lang/lexer.clj
+++ b/src/lang/lexer.clj
@@ -53,19 +53,19 @@
(exec [_ (lex-str "#(")
;; :let [_ (prn 'OPEN)]
;; comment (lex-regex #"^(#\(.*\)#)")
- comment (try-all-m [(lex-regex #"^((?!#\().)*?(?=\)#)")
- (exec [pre (lex-regex #"^(.+?(?=#\())")
+ comment (try-all-m [(lex-regex #"(?is)^((?!#\().)*?(?=\)#)")
+ (exec [pre (lex-regex #"(?is)^(.+?(?=#\())")
;; :let [_ (prn 'PRE pre)]
[_ inner] lex-multi-line-comment
;; :let [_ (prn 'INNER inner)]
- post (lex-regex #"^(.+?(?=\)#))")
+ post (lex-regex #"(?is)^(.+?(?=\)#))")
;:let [_ (prn 'POST post)]
]
(return (str pre "#(" inner ")#" post)))])
;; :let [_ (prn 'COMMENT comment)]
_ (lex-str ")#")
;; :let [_ (prn 'CLOSE)]
- ;; :let [_ (prn 'multi-comment comment)]
+ :let [_ (prn 'multi-comment comment)]
]
(return [::comment comment])))