diff --git a/beautiful-racket-demo/basic-demo/expander.rkt b/beautiful-racket-demo/basic-demo/expander.rkt index 143acb4..d7f466f 100644 --- a/beautiful-racket-demo/basic-demo/expander.rkt +++ b/beautiful-racket-demo/basic-demo/expander.rkt @@ -15,7 +15,7 @@ (define-macro (b-line LINE-NUMBER STATEMENT) (with-pattern ([CALLER-STX caller-stx]) - #'($line LINE-NUMBER (thunk STATEMENT) (syntax-srcloc #'CALLER-STX)))) + #'($line LINE-NUMBER (λ () STATEMENT) (syntax-srcloc #'CALLER-STX)))) (define (b-statement stmt) stmt) (define (b-rem str) #f) @@ -42,5 +42,5 @@ (define this-result (this-thunk)) (if (exact-positive-integer? this-result) (hash-ref line-idx-table this-result - (thunk (raise-line-not-found ($line-srcloc this-line)))) + (λ () (raise-line-not-found ($line-srcloc this-line)))) (add1 line-idx))))) \ No newline at end of file diff --git a/beautiful-racket-demo/basic-demo/tokenizer.rkt b/beautiful-racket-demo/basic-demo/tokenizer.rkt index b871c45..073f07d 100644 --- a/beautiful-racket-demo/basic-demo/tokenizer.rkt +++ b/beautiful-racket-demo/basic-demo/tokenizer.rkt @@ -8,39 +8,12 @@ (lexer-src-pos [(eof) eof] [whitespace (token lexeme #:skip? #t)] - [(from/to "rem" "\n") - (token 'REM - (string-downcase lexeme) - #:position (pos lexeme-start) - #:line (line lexeme-start) - #:column (col lexeme-start) - #:span (- (pos lexeme-end) - (pos lexeme-start)))] - [(:or "print" "goto" "end") - (token (string-downcase lexeme) - (string-downcase lexeme) - #:position (pos lexeme-start) - #:line (line lexeme-start) - #:column (col lexeme-start) - #:span (- (pos lexeme-end) - (pos lexeme-start)))] - [(:+ numeric) - (token 'NUMBER - (string->number lexeme) - #:position (pos lexeme-start) - #:line (line lexeme-start) - #:column (col lexeme-start) - #:span (- (pos lexeme-end) - (pos lexeme-start)))] - [(from/to "\"" "\"") - (token 'STRING - (trim-ends "\"" lexeme "\"") - #:position (pos lexeme-start) - #:line (line lexeme-start) - #:column (col lexeme-start) - #:span (- (pos lexeme-end) - (pos lexeme-start)))])) + [(from/to "rem" "\n") (token 'REM (string-downcase lexeme))] + [(:or "print" "goto" "end") (token (string-downcase lexeme) + (string-downcase lexeme))] + [(:+ numeric) (token 'NUMBER (string->number lexeme))] + [(from/to "\"" "\"") (token 'STRING (trim-ends "\"" lexeme "\""))])) (define (tokenize ip) (port-count-lines! ip) - (thunk (basic-lexer ip))) \ No newline at end of file + (λ () (basic-lexer ip))) \ No newline at end of file