more generous repl

pull/10/head
Matthew Butterick 8 years ago
parent 634c1d1f51
commit 41a898b268

@ -1,6 +1,6 @@
#lang br
(require "struct.rkt")
(provide b-rem b-print b-let b-input b-statement b-require)
(provide b-rem b-print b-let b-input b-statements b-require)
(define (b-rem val) (void))
@ -14,6 +14,6 @@
[num (string->number (string-trim str))])
(or num str))))
(define-macro (b-statement STMT) #'STMT)
(define-macro (b-statements STMT ...) #'(begin STMT ...))
(define-macro (b-require ID) #'(void))

@ -1,12 +1,13 @@
#lang brag
b-program : [b-line] (/NEWLINE [b-line])* | b-statement /NEWLINE
b-line : b-line-num [b-statement] (/":" [b-statement])* [b-rem]
b-line : b-line-num b-statements [b-rem]
@b-line-num : INTEGER
b-rem : REM
@b-statements : [b-statement] (/":" [b-statement])*
@b-statement : b-end | b-print | b-goto
| b-let | b-input | b-if
| b-gosub | b-return | b-for | b-next
| b-def | b-require
| b-def | b-require | b-expr
b-end : /"end"
b-print : /"print" [b-printable] (/";" [b-printable])*
@b-printable : STRING | b-expr

@ -4,10 +4,11 @@
(define basic-output-port (make-parameter (open-output-nowhere)))
(define statement-parser (make-rule-parser b-statements))
(define (configure-this!)
(basic-output-port (current-output-port))
(define statement-parser (make-rule-parser b-statement))
(define (read-one-line path port)
(define one-line (read-line port))
(if (eof-object? one-line)

Loading…
Cancel
Save