You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
371 B
Racket
15 lines
371 B
Racket
#lang br/quicklang
|
|
(require brag/support)
|
|
|
|
(define (tokenize port)
|
|
(define (next-token)
|
|
(define our-lexer
|
|
(lexer
|
|
[(eof) eof]
|
|
[(from/to "//" "\n") (next-token)]
|
|
[(from/to "@$" "$@")
|
|
(token 'SEXP-TOK (trim-ends "@$" lexeme "$@"))]
|
|
[any-char (token 'CHAR-TOK lexeme)]))
|
|
(our-lexer port))
|
|
next-token)
|
|
(provide tokenize) |