Created
April 2, 2013 20:34
-
-
Save dyoo/5295929 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require parser-tools/lex) | |
(require (prefix-in : parser-tools/lex-sre)) | |
(require racket/port) | |
(define a-lexer | |
(lexer ("a" `(A ,lexeme)) | |
((eof) eof))) | |
;; produce a list of pairs for all the A tokens in the string "aa" | |
(call-with-input-string "aa" | |
(lambda (p) | |
(sequence->list | |
(in-producer (lambda () (a-lexer p)) | |
eof)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment