perplexed: earley is failing, but not sure why
This commit is contained in:
parent
70eaf2c055
commit
fff511672d
|
@ -84,10 +84,11 @@
|
||||||
(make-bootstrapped-primitive-code
|
(make-bootstrapped-primitive-code
|
||||||
'map
|
'map
|
||||||
'(letrec ([map (lambda (f l)
|
'(letrec ([map (lambda (f l)
|
||||||
(if (null? l)
|
(displayln "in map")
|
||||||
null
|
(if (null? l)
|
||||||
(cons (f (car l))
|
null
|
||||||
(map f (cdr l)))))])
|
(cons (f (car l))
|
||||||
|
(map f (cdr l)))))])
|
||||||
map))
|
map))
|
||||||
|
|
||||||
(make-bootstrapped-primitive-code
|
(make-bootstrapped-primitive-code
|
||||||
|
|
|
@ -863,7 +863,6 @@
|
||||||
(append-instruction-sequences
|
(append-instruction-sequences
|
||||||
(make-instruction-sequence
|
(make-instruction-sequence
|
||||||
`(,(Lam-entry-label exp)))
|
`(,(Lam-entry-label exp)))
|
||||||
|
|
||||||
maybe-unsplice-rest-argument
|
maybe-unsplice-rest-argument
|
||||||
maybe-install-closure-values
|
maybe-install-closure-values
|
||||||
lam-body-code)))
|
lam-body-code)))
|
||||||
|
|
|
@ -154,10 +154,10 @@
|
||||||
(eq? x y)))
|
(eq? x y)))
|
||||||
|
|
||||||
|
|
||||||
(provide-stub-function #;xml->s-exp
|
|
||||||
#;js-object?
|
|
||||||
|
|
||||||
write
|
;; Many of these should be pushed upward rather than stubbed, so that
|
||||||
|
;; Racket's compiler can optimize these.
|
||||||
|
(provide-stub-function write
|
||||||
display
|
display
|
||||||
newline
|
newline
|
||||||
current-print
|
current-print
|
||||||
|
@ -165,7 +165,7 @@
|
||||||
continuation-mark-set?
|
continuation-mark-set?
|
||||||
continuation-mark-set->list
|
continuation-mark-set->list
|
||||||
for-each
|
for-each
|
||||||
;; make-thread-cell
|
|
||||||
make-struct-type
|
make-struct-type
|
||||||
make-struct-field-accessor
|
make-struct-field-accessor
|
||||||
make-struct-field-mutator
|
make-struct-field-mutator
|
||||||
|
|
|
@ -259,6 +259,11 @@
|
||||||
|
|
||||||
[(CheckToplevelBound!? op)
|
[(CheckToplevelBound!? op)
|
||||||
(let: ([a-top : toplevel (ensure-toplevel (env-ref m (CheckToplevelBound!-depth op)))])
|
(let: ([a-top : toplevel (ensure-toplevel (env-ref m (CheckToplevelBound!-depth op)))])
|
||||||
|
(when (> (CheckToplevelBound!-pos op)
|
||||||
|
(length (toplevel-vals a-top)))
|
||||||
|
(printf "ERROR: toplevel is length ~s, but trying to refer to ~s"
|
||||||
|
(length (toplevel-vals a-top))
|
||||||
|
(CheckToplevelBound!-pos op)))
|
||||||
(cond
|
(cond
|
||||||
[(undefined? (list-ref (toplevel-vals a-top) (CheckToplevelBound!-pos op)))
|
[(undefined? (list-ref (toplevel-vals a-top) (CheckToplevelBound!-pos op)))
|
||||||
(error 'check-toplevel-bound! "Unbound identifier ~s"
|
(error 'check-toplevel-bound! "Unbound identifier ~s"
|
||||||
|
|
|
@ -349,7 +349,8 @@
|
||||||
(even? 1023)
|
(even? 1023)
|
||||||
(even? 2172)
|
(even? 2172)
|
||||||
(even? 2171)))
|
(even? 2171)))
|
||||||
(list #t #f #t #f))
|
(list #t #f #t #f)
|
||||||
|
#:with-bootstrapping? #t)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -404,6 +405,13 @@
|
||||||
0))
|
0))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(test '(map (lambda (x) (* x x))
|
||||||
|
'(1 2 3 4 5))
|
||||||
|
'(1 4 9 16 25)
|
||||||
|
#:with-bootstrapping? #t)
|
||||||
|
|
||||||
|
|
||||||
;; Foldl
|
;; Foldl
|
||||||
(test '(let()
|
(test '(let()
|
||||||
(define (foldl f acc lst)
|
(define (foldl f acc lst)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#lang racket/base
|
#lang racket/base
|
||||||
|
|
||||||
(require (prefix-in racket: racket/base)
|
(require (prefix-in racket: racket/base)
|
||||||
|
racket/runtime-path
|
||||||
"compiler-structs.rkt"
|
"compiler-structs.rkt"
|
||||||
"compiler.rkt"
|
"compiler.rkt"
|
||||||
"parse-bytecode-5.1.1.rkt"
|
"parse-bytecode-5.1.1.rkt"
|
||||||
|
@ -9,11 +10,16 @@
|
||||||
|
|
||||||
(provide parse run-compiler)
|
(provide parse run-compiler)
|
||||||
|
|
||||||
|
(define-runtime-path kernel-language-path
|
||||||
|
"lang/kernel.rkt")
|
||||||
|
|
||||||
|
|
||||||
;; Use Racket's compiler, and then parse the resulting bytecode
|
;; Use Racket's compiler, and then parse the resulting bytecode
|
||||||
;; to our own AST structures.
|
;; to our own AST structures.
|
||||||
(define (parse stx)
|
(define (parse stx)
|
||||||
(parameterize ([current-namespace (lookup-language-namespace 'racket/base)])
|
(parameterize ([current-namespace (lookup-language-namespace
|
||||||
|
`(file ,(path->string kernel-language-path))
|
||||||
|
#;'racket/base)])
|
||||||
(let ([bc (racket:compile stx)]
|
(let ([bc (racket:compile stx)]
|
||||||
[op (open-output-bytes)])
|
[op (open-output-bytes)])
|
||||||
(write bc op)
|
(write bc op)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user