repl setup

pull/10/head
Matthew Butterick 8 years ago
parent 8be5afd15c
commit 5cc0f73028

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

@ -1,12 +1,16 @@
#lang br
(require (prefix-in basic: (submod "main.rkt" reader)))
(require "parser.rkt" "tokenizer.rkt")
(provide current-basic-port configure-repl!)
(define current-basic-port (make-parameter #f))
(define (configure-repl!)
;; wrap REPL interactions with pollen expression support
(define racket-read (current-read-interaction))
(define (basic-read src in)
(basic:read-syntax src in))
(current-read-interaction basic-read))
(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)
eof
(statement-parser (make-tokenizer (open-input-string one-line)))))
(current-read-interaction read-one-line))

@ -1,2 +1,4 @@
#lang basic-demo-3
10 print "got shell arg" : print arg0 : print arg1
20 a = 5
30 def f(x) = x ^ x
Loading…
Cancel
Save