9 The entry point
The main program has the task of gluing everything so far together. It picks a source input (either the first file argument or stdin) and runs the basic read-eval loop from the previous section.
«entry-point» ::=
(module+ main (let ([source-input-port (if (> (vector-length (current-command-line-arguments)) 0) (open-input-file (vector-ref (current-command-line-arguments) 0)) (current-input-port))]) (let-values ([(ctx stack) (interp-run (make-context #:definitions (read-eval-loop-definitions (*builtins*) source-input-port) ; Run the loop on its own #:body '(read-eval-loop)) ; Start with an empty stack '())]) (void))))