Skip to content

Instantly share code, notes, and snippets.

@dyoo
Created April 2, 2013 20:34
Show Gist options
  • Save dyoo/5295929 to your computer and use it in GitHub Desktop.
Save dyoo/5295929 to your computer and use it in GitHub Desktop.
#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