From 302d0461652a00a88c98dfd58319f4871f8a4979 Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Tue, 30 Aug 2011 02:10:03 -0400 Subject: [PATCH] fixing the base (untraced) language --- base/{reader => lang}/reader.rkt | 2 +- js-assembler/assemble-perform-statement.rkt | 2 +- js-assembler/runtime-src/runtime.js | 14 ++++++++++++++ lang/whalesong.rkt | 6 ++---- tests/more-tests/booleans.rkt | 2 +- tests/more-tests/colors.rkt | 2 +- tests/more-tests/conform.rkt | 2 +- tests/more-tests/earley.rkt | 2 +- tests/more-tests/hello.rkt | 2 +- tests/more-tests/images.rkt | 2 +- tests/more-tests/lists.rkt | 2 +- tests/more-tests/man-vs-boy.rkt | 2 +- tests/more-tests/numbers.rkt | 2 +- tests/more-tests/simple-apply.rkt | 2 +- tests/more-tests/simple-functions.rkt | 2 +- tests/more-tests/simple-structs.rkt | 2 +- tests/more-tests/sk-generator-2.rkt | 2 +- tests/more-tests/sk-generator.rkt | 2 +- tests/more-tests/string-tests.rkt | 2 +- 19 files changed, 33 insertions(+), 21 deletions(-) rename base/{reader => lang}/reader.rkt (76%) diff --git a/base/reader/reader.rkt b/base/lang/reader.rkt similarity index 76% rename from base/reader/reader.rkt rename to base/lang/reader.rkt index 82f1021..4480bf8 100644 --- a/base/reader/reader.rkt +++ b/base/lang/reader.rkt @@ -6,4 +6,4 @@ `(file ,(path->string base-lang-path))) (require racket/runtime-path) -(define-runtime-path base-lang-path "../lang/base.rkt") +(define-runtime-path base-lang-path "../../lang/base.rkt") diff --git a/js-assembler/assemble-perform-statement.rkt b/js-assembler/assemble-perform-statement.rkt index 58fa986..868115b 100644 --- a/js-assembler/assemble-perform-statement.rkt +++ b/js-assembler/assemble-perform-statement.rkt @@ -140,7 +140,7 @@ EOF (assemble-oparg (UnspliceRestFromStack!-length op)))] [(InstallContinuationMarkEntry!? op) - (string-append "RUNTIME.installContinuationMarkEntry(MACHINE," + (string-append "MACHINE.installContinuationMarkEntry(" "MACHINE.control[MACHINE.control.length-1].pendingContinuationMarkKey," "MACHINE.val);")] diff --git a/js-assembler/runtime-src/runtime.js b/js-assembler/runtime-src/runtime.js index 8f00a3e..21833ce 100644 --- a/js-assembler/runtime-src/runtime.js +++ b/js-assembler/runtime-src/runtime.js @@ -341,6 +341,20 @@ }; + // Save the continuation mark on the top control frame. + Machine.prototype.installContinuationMarkEntry = function(key, value) { + var frame = this.control[this.control.length - 1]; + var marks = frame.marks; + var i; + for (i = 0; i < marks.length; i++) { + if (equals(key, marks[i][0])) { + marks[i][1] = value; + return; + } + } + marks.push([key, value]); + }; + diff --git a/lang/whalesong.rkt b/lang/whalesong.rkt index 0ff23f3..cada881 100644 --- a/lang/whalesong.rkt +++ b/lang/whalesong.rkt @@ -7,7 +7,5 @@ ;; If you don't want this, write in whalesong/base instead. (provide (except-out (all-from-out "base.rkt") - ;;#%app - ) - ;;(rename-out [traced-app #%app]) - ) \ No newline at end of file + #%app) + (rename-out [traced-app #%app])) \ No newline at end of file diff --git a/tests/more-tests/booleans.rkt b/tests/more-tests/booleans.rkt index 93fd1bc..ad53659 100644 --- a/tests/more-tests/booleans.rkt +++ b/tests/more-tests/booleans.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (boolean? "t") (boolean? #t) diff --git a/tests/more-tests/colors.rkt b/tests/more-tests/colors.rkt index e8551ca..d02ed7b 100644 --- a/tests/more-tests/colors.rkt +++ b/tests/more-tests/colors.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (require (planet dyoo/whalesong/image)) (color 3 4 5 0) diff --git a/tests/more-tests/conform.rkt b/tests/more-tests/conform.rkt index cbef743..0c888aa 100644 --- a/tests/more-tests/conform.rkt +++ b/tests/more-tests/conform.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (let () ;; (define (caar l) diff --git a/tests/more-tests/earley.rkt b/tests/more-tests/earley.rkt index 7ac0cf9..55aeffe 100644 --- a/tests/more-tests/earley.rkt +++ b/tests/more-tests/earley.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (begin (define make-parser (lambda (grammar lexer) diff --git a/tests/more-tests/hello.rkt b/tests/more-tests/hello.rkt index 689622c..9c5e421 100644 --- a/tests/more-tests/hello.rkt +++ b/tests/more-tests/hello.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (displayln "hello world") diff --git a/tests/more-tests/images.rkt b/tests/more-tests/images.rkt index f3a5aac..d27c817 100644 --- a/tests/more-tests/images.rkt +++ b/tests/more-tests/images.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (require (planet dyoo/whalesong/image)) (image-color? "red") diff --git a/tests/more-tests/lists.rkt b/tests/more-tests/lists.rkt index 0c482e4..4c78111 100644 --- a/tests/more-tests/lists.rkt +++ b/tests/more-tests/lists.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base '(1 2 3) (list "hello" "world") diff --git a/tests/more-tests/man-vs-boy.rkt b/tests/more-tests/man-vs-boy.rkt index 8583b87..5af98d9 100644 --- a/tests/more-tests/man-vs-boy.rkt +++ b/tests/more-tests/man-vs-boy.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base ;; Knuth's Man-or-boy-test. ;; http://rosettacode.org/wiki/Man_or_boy_test diff --git a/tests/more-tests/numbers.rkt b/tests/more-tests/numbers.rkt index f57bc3f..470c928 100644 --- a/tests/more-tests/numbers.rkt +++ b/tests/more-tests/numbers.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (number? 0) diff --git a/tests/more-tests/simple-apply.rkt b/tests/more-tests/simple-apply.rkt index 361bc8a..3006e29 100644 --- a/tests/more-tests/simple-apply.rkt +++ b/tests/more-tests/simple-apply.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (apply + 2 3 4 5 '()) (apply + 2 3 4 '(5)) diff --git a/tests/more-tests/simple-functions.rkt b/tests/more-tests/simple-functions.rkt index fe62f67..f4345b6 100644 --- a/tests/more-tests/simple-functions.rkt +++ b/tests/more-tests/simple-functions.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (provide (all-defined-out)) diff --git a/tests/more-tests/simple-structs.rkt b/tests/more-tests/simple-structs.rkt index b98e47a..200edc6 100644 --- a/tests/more-tests/simple-structs.rkt +++ b/tests/more-tests/simple-structs.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (define-struct pair (f r)) (define-struct color (r g b)) diff --git a/tests/more-tests/sk-generator-2.rkt b/tests/more-tests/sk-generator-2.rkt index c440962..949c08e 100644 --- a/tests/more-tests/sk-generator-2.rkt +++ b/tests/more-tests/sk-generator-2.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (define (make-gen gen) (let ([cont (box #f)]) (lambda () diff --git a/tests/more-tests/sk-generator.rkt b/tests/more-tests/sk-generator.rkt index be97451..44e73bd 100644 --- a/tests/more-tests/sk-generator.rkt +++ b/tests/more-tests/sk-generator.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (define (make-gen gen) (let ([cont #f]) (lambda () diff --git a/tests/more-tests/string-tests.rkt b/tests/more-tests/string-tests.rkt index e950677..0881717 100644 --- a/tests/more-tests/string-tests.rkt +++ b/tests/more-tests/string-tests.rkt @@ -1,4 +1,4 @@ -#lang planet dyoo/whalesong +#lang planet dyoo/whalesong/base (substring "hello world" 0) (substring "hello world" 1)