pull/10/head
Matthew Butterick 8 years ago
parent dfe6ef6ffd
commit 10bd6435d4

@ -18,9 +18,12 @@
(define-macro (b-export NAME) #'(void))
(define-macro (b-repl . ARGS)
(with-pattern ([STMTS (pattern-case-filter #'ARGS
[(b-expr . EXPR-ARGS)
#'(b-print (b-expr . EXPR-ARGS))]
[OTHER-STMT #'OTHER-STMT])])
#'(begin . STMTS)))
(define-macro (b-repl . REPL-INPUTS)
(with-pattern ([INPUTS (pattern-case-filter #'REPL-INPUTS
[(b-expr . EXPR-ARGS)
#'(b-print (b-expr . EXPR-ARGS))]
[(b-print . PRINT-ARGS)
#'(b-print . PRINT-ARGS)]
[OTHER
#'(error 'invalid-repl-input)])])
#'(begin . INPUTS)))

@ -37,4 +37,4 @@ b-expt : [b-expt ("^")] b-value
@b-value : b-number | b-id | /"(" b-expr /")" | b-func
b-func : (ID | RACKET-ID) /"(" b-expr [/"," b-expr]* /")"
@b-number : INTEGER | DECIMAL
b-repl : (b-statement | b-expr) (/":" [b-repl])*
b-repl : (b-statement | b-expr) (/":" [@b-repl])*

@ -5,17 +5,15 @@
(define basic-output-port
(make-parameter (open-output-nowhere)))
(define (do-setup! [where #f])
(basic-output-port (current-output-port))
#;(current-read-interaction read-one-line))
(define repl-parser (make-rule-parser b-repl))
(define repl-parse (make-rule-parser b-repl))
(define (read-one-line path port)
(define (read-one-line origin port)
(define one-line (read-line port))
(if (eof-object? one-line)
eof
(repl-parser
(repl-parse
(make-tokenizer (open-input-string one-line)))))
(define (do-setup! [where #f])
(basic-output-port (current-output-port))
(current-read-interaction read-one-line))
Loading…
Cancel
Save