updating interpreter to work better for bootstrapping
adding program mkboot0, which can be run in the interpreter to compile source files into a stage-0 boot image.
This commit is contained in:
parent
909b91ffcc
commit
1259c17837
|
@ -0,0 +1,19 @@
|
||||||
|
; -*- scheme -*-
|
||||||
|
|
||||||
|
(if (not (bound? 'top-level-value)) (set! top-level-value %eval))
|
||||||
|
(if (not (bound? 'set-top-level-value!)) (set! set-top-level-value! set))
|
||||||
|
|
||||||
|
(load "compiler.lsp")
|
||||||
|
|
||||||
|
(define (compile-file inf)
|
||||||
|
(let ((in (file inf :read)))
|
||||||
|
(let next ((E (read in)))
|
||||||
|
(if (not (io.eof? in))
|
||||||
|
(begin (print (compile-thunk (expand E)))
|
||||||
|
(princ "\n")
|
||||||
|
(next (read in)))))
|
||||||
|
(io.close in)))
|
||||||
|
|
||||||
|
(for-each (lambda (file)
|
||||||
|
(compile-file file))
|
||||||
|
(cdr *argv*))
|
|
@ -575,8 +575,14 @@ static value_t do_read_sexpr(value_t label)
|
||||||
// cannot see pending labels. in other words:
|
// cannot see pending labels. in other words:
|
||||||
// (... #2=#.#0# ... ) OK
|
// (... #2=#.#0# ... ) OK
|
||||||
// (... #2=#.(#2#) ... ) DO NOT WANT
|
// (... #2=#.(#2#) ... ) DO NOT WANT
|
||||||
v = do_read_sexpr(UNBOUND);
|
sym = do_read_sexpr(UNBOUND);
|
||||||
return toplevel_eval(v);
|
if (issymbol(sym)) {
|
||||||
|
v = symbol_value(sym);
|
||||||
|
if (v == UNBOUND)
|
||||||
|
raise(list2(UnboundError, sym));
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
return toplevel_eval(sym);
|
||||||
case TOK_LABEL:
|
case TOK_LABEL:
|
||||||
// create backreference label
|
// create backreference label
|
||||||
if (ptrhash_has(&readstate->backrefs, (void*)tokval))
|
if (ptrhash_has(&readstate->backrefs, (void*)tokval))
|
||||||
|
|
Loading…
Reference in New Issue