tracing bug in environment handling

This commit is contained in:
Danny Yoo 2011-03-10 14:49:50 -05:00
parent 49a53c0864
commit 634e23daa8
5 changed files with 25 additions and 9 deletions

View File

@ -215,8 +215,8 @@ EOF
(format "~a = ~a;" t (assemble-oparg v)))]
[(AssignPrimOpStatement? stmt)
(format "MACHINE.~a=~a;"
(AssignPrimOpStatement-target stmt)
(format "~a=~a;"
(assemble-target (AssignPrimOpStatement-target stmt))
(assemble-op-expression (AssignPrimOpStatement-op stmt)))]
[(PerformStatement? stmt)
@ -235,8 +235,7 @@ EOF
(assemble-label (make-Label (TestAndBranchStatement-label stmt))))]))]
[(GotoStatement? stmt)
(format "return ~a();"
(assemble-location (GotoStatement-target stmt)))]
(format "return ~a();" (assemble-location (GotoStatement-target stmt)))]
[(PushControlFrame? stmt)
(format "MACHINE.control.push(new Frame(~a, MACHINE.proc));" (PushControlFrame-label stmt))]
[(PopControlFrame? stmt)

View File

@ -1,9 +1,9 @@
#lang racket/base
(require "compile.rkt"
"typed-structs.rkt"
"assemble.rkt"
"typed-parse.rkt"
"il-structs.rkt"
racket/runtime-path
racket/port)
@ -21,9 +21,9 @@
(copy-port ip op)))
(newline op)
(fprintf op "var invoke = ")
(assemble/write-invoke (statements (compile-top (parse source-code)
'val
'return))
(assemble/write-invoke (compile (parse source-code)
'val
'next)
op)
(fprintf op ";\n"))

View File

@ -45,5 +45,8 @@
abs
void
quotient
remainder)
remainder
display
displayln
newline)
#:constants (null pi e)))

View File

@ -328,6 +328,8 @@
v]
[(null? v)
v]
[(void? v)
v]
[(cons? v)
(cons (loop (car v)) (loop (cdr v)))]
[(primitive-proc? v)

View File

@ -448,5 +448,17 @@
(expt 2 23984000)))
(test (begin (define (length l)
(if (null? l)
0
(+ 1 (length (cdr l)))))
(display (length (list 1 2 3 4 5 6)))
(newline)
#;(display (length (list "hello" "world")))
#;(newline))
(void))
;(simulate (compile (parse '42) 'val 'next))
;(compile (parse '(+ 3 4)) 'val 'next)