From 6c5c857412c55aa1e015625afa6cdf163dea159b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 21 Mar 2015 20:26:24 -0400 Subject: - Added the reading-phase and it's associated structure as the mediator between raw source-code and the lexing-phase. --- source/lux.lux | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'source/lux.lux') diff --git a/source/lux.lux b/source/lux.lux index fd895f25c..d3ed0c3a3 100644 --- a/source/lux.lux +++ b/source/lux.lux @@ -2,6 +2,26 @@ (jvm-interface Function (: apply (-> [java.lang.Object] java.lang.Object))) +## (jvm-interface Function +## [apply ([java.lang.Object] java.lang.Object)]) + +## (jvm-class Function +## (modifiers public abstract) +## (fields) +## (abstract-methods +## [apply1 ([java.lang.Object] java.lang.Object)]) +## (virtual-methods +## [apply2 ((this [arg1 java.lang.Object] [arg2 java.lang.Object]) +## java.lang.Object +## (jvm-invokevirtual lux.Function "apply1" [java.lang.Object] +## (jvm-invokevirtual lux.Function "apply1" [java.lang.Object] +## this [arg1]) [arg2]))] +## [apply3 ((this [arg1 java.lang.Object] [arg2 java.lang.Object] [arg3 java.lang.Object]) +## java.lang.Object +## (jvm-invokevirtual lux.Function "apply1" [java.lang.Object] +## (jvm-invokevirtual lux.Function "apply2" [java.lang.Object java.lang.Object] +## this [arg1 arg2]) [arg3]))])) + ## Base functions & macros (def' let' (lambda' _ tokens @@ -57,11 +77,11 @@ (lambda [tokens state] (let' output (case' tokens (#Cons [(#Symbol name) (#Cons [body #Nil])]) - (#Form (#Cons [(#Symbol ["lux" "def'"]) tokens])) + (#Form (#Cons [(#Symbol ["" "def'"]) tokens])) (#Cons [(#Form (#Cons [(#Symbol name) args])) (#Cons [body #Nil])]) - (#Form (#Cons [(#Symbol ["lux" "def'"]) + (#Form (#Cons [(#Symbol ["" "def'"]) (#Cons [(#Symbol name) (#Cons [(#Form (#Cons [(#Symbol ["lux" "lambda"]) (#Cons [(#Symbol name) @@ -80,7 +100,7 @@ (#Cons [(#Form (#Cons [(#Symbol fn-name) args])) (#Cons [body #Nil])])]))]) - (let' declaration (#Form (#Cons [(#Symbol ["lux" "declare-macro"]) (#Cons [(#Symbol fn-name) #Nil])])) + (let' declaration (#Form (#Cons [(#Symbol ["" "declare-macro"]) (#Cons [(#Symbol fn-name) #Nil])])) (#Right [state (#Cons [fn-def (#Cons [declaration #Nil])])])))) (declare-macro defmacro) @@ -758,7 +778,8 @@ (` (#All (list) (~ (#Text "")) (~ (#Text arg-name)) (~ (replace-ident [arg-module arg-name] (` (#Bound (~ (#Text arg-name)))) body)))))) - body args)] + body + args)] (case' rolled (#Form (#Cons [(#Tag ["lux" "TAll"]) (#Cons [env (#Cons [(#Test "") (#Cons [(#Text arg-name) (#Cons [body #Nil])])])])])) (return (list (` (#All (~ env) (~ (#Text name)) (~ (#Text arg-name)) -- cgit v1.2.3