From 0666c9d389ce0b8eb8d674400aaeaa7b7a668b7f Mon Sep 17 00:00:00 2001 From: Danny Yoo Date: Tue, 10 May 2011 00:00:36 -0400 Subject: [PATCH] letrec boxenv installvalue --- parse-bytecode-5.1.1.rkt | 11 ++++++++-- test-parse-bytecode-5.1.1.rkt | 38 ++++++++++++++++++++++++++--------- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/parse-bytecode-5.1.1.rkt b/parse-bytecode-5.1.1.rkt index 20d4f3a..25598aa 100644 --- a/parse-bytecode-5.1.1.rkt +++ b/parse-bytecode-5.1.1.rkt @@ -407,7 +407,11 @@ (define (parse-install-value expr) - (error 'fixmeinstallvalue)) + (match expr + [(struct install-value (count pos boxes? rhs body)) + (make-Seq (list (make-InstallValue count pos (parse-expr-seq-constant rhs) boxes?) + (parse-expr-seq-constant body)))])) + (define (parse-let-rec expr) (match expr @@ -417,7 +421,10 @@ (parse-expr-seq-constant body))])) (define (parse-boxenv expr) - (error 'fixmeboxenv)) + (match expr + [(struct boxenv (pos body)) + (make-BoxEnv pos (parse-expr-seq-constant body))])) + (define (parse-localref expr) (match expr diff --git a/test-parse-bytecode-5.1.1.rkt b/test-parse-bytecode-5.1.1.rkt index 103d9fe..da2f746 100644 --- a/test-parse-bytecode-5.1.1.rkt +++ b/test-parse-bytecode-5.1.1.rkt @@ -206,17 +206,37 @@ '() 'lamEntry1) '())))) -(run-my-parse #'(letrec ([e (lambda (y) - (if (= y 0) - #t - (o (sub1 y))))] - [o (lambda (y) - (if (= y 0) - #f - (e sub1 y)))]) - e)) + +;; FIXME: make this a real test. +(begin + (reset-lam-label-counter!/unit-testing) + (void (run-my-parse #'(letrec ([e (lambda (y) + (if (= y 0) + #t + (o (sub1 y))))] + [o (lambda (y) + (if (= y 0) + #f + (e sub1 y)))]) + e)))) + +(check-equal? (run-my-parse #'(let ([x 3]) + (set! x (add1 x)) + x)) + (make-Top (make-Prefix '()) + (make-Let1 + (make-Constant 3) + (make-BoxEnv 0 + (make-Seq + (list + (make-InstallValue + 1 0 + (make-App (make-PrimitiveKernelValue 'add1) + (list (make-LocalRef 1 #t))) + #t) + (make-LocalRef 0 #t))))))) ;; make sure we don't see an infinite loop