|
|
@ -6,8 +6,9 @@
|
|
|
|
(define basic-lexer
|
|
|
|
(define basic-lexer
|
|
|
|
(lexer-srcloc
|
|
|
|
(lexer-srcloc
|
|
|
|
[(eof) (return-without-srcloc eof)]
|
|
|
|
[(eof) (return-without-srcloc eof)]
|
|
|
|
|
|
|
|
[(from/stop-before "rem" "\n") (token 'REM lexeme)]
|
|
|
|
|
|
|
|
[(:seq "\n" digits) (token 'LINE-NUMBER (string->number (string-trim lexeme)))]
|
|
|
|
[whitespace (token lexeme #:skip? #t)]
|
|
|
|
[whitespace (token lexeme #:skip? #t)]
|
|
|
|
[(from/to "rem" "\n") (token 'REM lexeme)]
|
|
|
|
|
|
|
|
[(:or "print" "goto" "end" "+" ":") lexeme]
|
|
|
|
[(:or "print" "goto" "end" "+" ":") lexeme]
|
|
|
|
[digits (token 'INTEGER (string->number lexeme))]
|
|
|
|
[digits (token 'INTEGER (string->number lexeme))]
|
|
|
|
[(:or (:seq (:? digits) "." digits)
|
|
|
|
[(:or (:seq (:? digits) "." digits)
|
|
|
|