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