switching out the baby parser in the bootstrapped primitives with the real one. Also removing implicit begin in the example
This commit is contained in:
parent
cad4087134
commit
f0829cdc57
|
@ -3,14 +3,18 @@
|
||||||
"expression-structs.rkt"
|
"expression-structs.rkt"
|
||||||
"lexical-structs.rkt"
|
"lexical-structs.rkt"
|
||||||
"il-structs.rkt"
|
"il-structs.rkt"
|
||||||
"compiler.rkt"
|
(except-in "compiler.rkt" compile)
|
||||||
"compiler-structs.rkt")
|
"compiler-structs.rkt")
|
||||||
|
|
||||||
|
(require (rename-in "compiler.rkt"
|
||||||
|
[compile whalesong-compile]))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(require/typed "../parameters.rkt"
|
(require/typed "../parameters.rkt"
|
||||||
(current-defined-name (Parameterof (U Symbol LamPositionalName))))
|
(current-defined-name (Parameterof (U Symbol LamPositionalName))))
|
||||||
(require/typed "../parser/parse-bytecode.rkt"
|
(require/typed "../parser/parse-bytecode.rkt"
|
||||||
(parse-bytecode (Path -> Expression)))
|
(parse-bytecode (Any -> Expression)))
|
||||||
|
|
||||||
(require/typed "../parser/baby-parser.rkt"
|
(require/typed "../parser/baby-parser.rkt"
|
||||||
[parse (Any -> Expression)])
|
[parse (Any -> Expression)])
|
||||||
|
@ -80,10 +84,14 @@
|
||||||
,(make-GotoStatement (make-Reg 'proc)))))))
|
,(make-GotoStatement (make-Reg 'proc)))))))
|
||||||
|
|
||||||
(: make-bootstrapped-primitive-code (Symbol Any -> (Listof Statement)))
|
(: make-bootstrapped-primitive-code (Symbol Any -> (Listof Statement)))
|
||||||
(define (make-bootstrapped-primitive-code name src)
|
(define make-bootstrapped-primitive-code
|
||||||
(parameterize ([current-defined-name name])
|
(let ([ns (make-base-namespace)])
|
||||||
(append
|
(lambda (name src)
|
||||||
(compile (parse src) (make-PrimitivesReference name) next-linkage/drop-multiple))))
|
(parameterize ([current-defined-name name])
|
||||||
|
(append
|
||||||
|
(whalesong-compile (parameterize ([current-namespace ns])
|
||||||
|
(parse-bytecode (compile src)))
|
||||||
|
(make-PrimitivesReference name) next-linkage/drop-multiple))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -495,8 +495,8 @@ For example,
|
||||||
|
|
||||||
For a web-world program, output is normally done by using
|
For a web-world program, output is normally done by using
|
||||||
@racket[to-draw]. However, side effecting functions, such as
|
@racket[to-draw]. However, side effecting functions, such as
|
||||||
@racket[printf] or @racket[display], are still available, and are
|
@racket[printf] or @racket[display], are still available, and will
|
||||||
allowed to continue to append to @tt{document.body}.
|
append to @tt{document.body}.
|
||||||
|
|
||||||
We may want to disable such printing or redirect it to a particular
|
We may want to disable such printing or redirect it to a particular
|
||||||
element on the page. For such purposes, use a combination of
|
element on the page. For such purposes, use a combination of
|
||||||
|
@ -511,8 +511,9 @@ For example:
|
||||||
...
|
...
|
||||||
(big-bang ...
|
(big-bang ...
|
||||||
(on-tick (lambda (world dom)
|
(on-tick (lambda (world dom)
|
||||||
(printf "Tick!\n")
|
(begin
|
||||||
(add1 world)))
|
(printf "Tick!\n")
|
||||||
|
(add1 world))))
|
||||||
...)
|
...)
|
||||||
}|
|
}|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user