From ffd31966ec6a5e362dd16911643a43e2ce098a11 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Fri, 30 Jan 2015 13:21:10 -0600 Subject: guide.md: step9,A stubs. TODO. More vector tests. --- docs/TODO | 16 +++++++++++++-- process/guide.md | 53 ++++++++++++++++++++++++++++++++++++++++++------ tests/step4_if_fn_do.mal | 10 +++++++++ 3 files changed, 71 insertions(+), 8 deletions(-) diff --git a/docs/TODO b/docs/TODO index 2814dbb..0b3fb59 100644 --- a/docs/TODO +++ b/docs/TODO @@ -1,4 +1,5 @@ All: + - rename stepA_interop to stepA_mal - test to check args set properly - test to make sure slurp captures final newline - make sure errors propagate/print properly when self-hosted @@ -14,10 +15,21 @@ All: - Implement/fix interop - Print full exception when test gets EOF from expect + - metadata on symbols + - metadata as a map only. ^ merges metadata in the reader itself. + Line numbers in metadata from reader. - protocols! - https://github.com/pixie-lang/pixie - http://www.toccata.io/2015/01/Mapping/ - + - namespaces + - environments first class: *ENV*, *outer* defined by env-new + - namespaces is *namespaces* map in environment which maps namespace + names to other environments. + - def! become an alias for (env-set! *ENV* 'sym value) + - Namespace lookup: go up the environment hierarchy until + a *namespaces* map is found with the namespace name being + looked up. Then the symbol would be looked up starting in + the namespace environment. Need protocols first probably. - Break out impl eval into step0.5 - Fix quasiquoting of vectors @@ -39,7 +51,7 @@ Bash: C: - come up with better way to do 20 vararg code - - GC + - GC: use http://www.hboehm.info/gc/ - fix mal/clojurewest2014.mal C#: diff --git a/process/guide.md b/process/guide.md index 10ef1ed..734dc32 100644 --- a/process/guide.md +++ b/process/guide.md @@ -833,6 +833,8 @@ the changes that will be made during this step: diff -urp ../process/step5_tco.txt ../process/step6_file.txt ``` +* Copy `step5_tco.qx` to `step6_file.qx`. + * Add two new string functions to the core namespaces: * `read-string`: this function just exposes the `read_str` function from the reader. If your mal string type is not the same as your @@ -909,12 +911,6 @@ add supporting core functions `cons` and `concat`. The two quote forms add a powerful abstraction for manipulating mal code itself (meta-programming). -Compare the pseudocode for step 6 and step 7 to get a basic idea of -the changes that will be made during this step: -``` -diff -urp ../process/step6_file.txt ../process/step7_quote.txt -``` - The `quote` special form indicates to the evaluator (`EVAL`) that the parameter should not be evaluated (yet). At first glance, this might not seem particular useful but an example of what this enables is the @@ -952,6 +948,14 @@ the evaluated value must be a list which is then "spliced" into the quasiquoted list. The true power of the quasiquote form will be manifest when it used together with macros (in the next step). +Compare the pseudocode for step 6 and step 7 to get a basic idea of +the changes that will be made during this step: +``` +diff -urp ../process/step6_file.txt ../process/step7_quote.txt +``` + +* Copy `step6_file.qx` to `step7_quote.qx`. + * Before implementing the quoting forms, you will need to implement * some supporting functions in the core namespace: * `cons`: this function takes a list as its second @@ -1057,6 +1061,9 @@ the changes that will be made during this step: diff -urp ../process/step7_quote.txt ../process/step8_macros.txt ``` +* Copy `step7_quote.qx` to `step8_macros.qx`. + + You might think that the infinite power of macros would require some sort of complex mechanism, but the implementation is actually fairly simple. @@ -1123,6 +1130,40 @@ make test^quux^step8 * `or`: "(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))" + + +### Step 9: Try + +![step9_try architecture](step9_try.png) + +Compare the pseudocode for step 8 and step 9 to get a basic idea of +the changes that will be made during this step: +``` +diff -urp ../process/step8_macros.txt ../process/step9_try.txt +``` + +* Copy `step8_macros.qx` to `step9_try.qx`. + +* TODO/TBD + + + + +### Step A: Interop and Self-hosting + +![stepA_interop architecture](stepA_interop.png) + +Compare the pseudocode for step 9 and step A to get a basic idea of +the changes that will be made during this step: +``` +diff -urp ../process/step9_try.txt ../process/stepA_interop.txt +``` + +* Copy `step9_try.qx` to `stepA_interop.qx`. + +* TODO/TBD + + ## TODO: * simplify: "X argument (list element Y)" -> ast[Y] diff --git a/tests/step4_if_fn_do.mal b/tests/step4_if_fn_do.mal index 46efeae..4adb4c8 100644 --- a/tests/step4_if_fn_do.mal +++ b/tests/step4_if_fn_do.mal @@ -351,6 +351,16 @@ a (if [] 7 8) ;=>7 +;; Testing vector functions +(count [1 2 3]) +;=>3 +(empty? [1 2 3]) +;=>false +(empty? []) +;=>true +(list? [4 5 6]) +;=>false + ;; Testing vector equality (= [] (list)) ;=>true -- cgit v1.2.3