If you want to use the "basic" language from Beautiful Racket in the command-line REPL, you need to require "setup.rkt" and "elements.rkt" and provide the bindings of "elements.rkt" as well as #%top-interaction #%app #%top #%datum to the expander macro "b-module-begin" in "expander.rkt". If you change the xrepl to use readline, you can enter basic expressions in the REPL, have them be evaluated and use REPL-history. Coloring doesn't work.
; "expander.rkt"
#lang br/quicklang
(require "struct.rkt" "run.rkt" "elements.rkt" "setup.rkt")
(provide (rename-out [b-module-begin #%module-begin])
(all-from-out "elements.rkt"))
(define-macro (b-module-begin (b-program LINE ...))
(with-pattern
([((b-line NUM STMT ...) ...) #'(LINE ...)]
[(LINE-FUNC ...) (prefix-id "line-" #'(NUM ...))]
[(VAR-ID ...) (find-property 'b-id #'(LINE ...))]
[(IMPORT-NAME ...)
(find-property 'b-import-name #'(LINE ...))]
[(EXPORT-NAME ...)
(find-property 'b-export-name #'(LINE ...))]
[((SHELL-ID SHELL-IDX) ...)
(make-shell-ids-and-idxs caller-stx)]
[(UNIQUE-ID ...)
(unique-ids
(syntax->list #'(VAR-ID ... SHELL-ID ...)))])
#'(#%module-begin
(module configure-runtime br
(require basic/setup)
(do-setup!))
;;;;;;;;;;;;;;;;; this is added! ;;;;;;;;;;;;;;;;;;;;;;;
(require
"setup.rkt"
"elements.rkt")
(provide
(all-from-out "elements.rkt")
#%top-interaction #%app #%top #%datum)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require IMPORT-NAME) ...
(provide EXPORT-NAME ...)
(define UNIQUE-ID 0) ...
(let ([clargs (current-command-line-arguments)])
(set! SHELL-ID (get-clarg clargs SHELL-IDX)) ...)
LINE ...
(define line-table
(apply hasheqv (append (list NUM LINE-FUNC) ...)))
(parameterize
([current-output-port (basic-output-port)])
(void (run line-table))))))
(define (get-clarg clargs idx)
(if (<= (vector-length clargs) idx)
0
(let ([val (vector-ref clargs idx)])
(or (string->number val) val))))
(begin-for-syntax
(require racket/list)
(define (unique-ids stxs)
(remove-duplicates stxs #:key syntax->datum))
(define (find-property which line-stxs)
(unique-ids
(for/list ([stx (in-list (stx-flatten line-stxs))]
#:when (syntax-property stx which))
stx)))
(define (make-shell-ids-and-idxs ctxt)
(define arg-count 10)
(for/list ([idx (in-range arg-count)])
(list (suffix-id #'arg idx #:context ctxt) idx))))
wurmli@cirrus7:~$ racket -I basic/sample
Welcome to Racket v8.10 [cs].
1
2
3
> div(7,6)
1.1666666666666667
> let z = 99
> z
99
>