diff --git a/femtolisp/mkboot0.lsp b/femtolisp/mkboot0.lsp new file mode 100644 index 0000000..9dd989e --- /dev/null +++ b/femtolisp/mkboot0.lsp @@ -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*)) diff --git a/femtolisp/read.c b/femtolisp/read.c index 4b08336..f5acb4a 100644 --- a/femtolisp/read.c +++ b/femtolisp/read.c @@ -575,8 +575,14 @@ static value_t do_read_sexpr(value_t label) // cannot see pending labels. in other words: // (... #2=#.#0# ... ) OK // (... #2=#.(#2#) ... ) DO NOT WANT - v = do_read_sexpr(UNBOUND); - return toplevel_eval(v); + sym = do_read_sexpr(UNBOUND); + if (issymbol(sym)) { + v = symbol_value(sym); + if (v == UNBOUND) + raise(list2(UnboundError, sym)); + return v; + } + return toplevel_eval(sym); case TOK_LABEL: // create backreference label if (ptrhash_has(&readstate->backrefs, (void*)tokval))