[plt-scheme] Learning Scheme Lexer
Hi all,
I'm trying to use the Scheme parser tools.
I've tried:
(require (lib "lex.ss" "parser-tools"))
(define-lex-abbrevs [letter (: (- "a" "z") (- "A" "Z"))]
[digit (- "0" "9")]
[number (@ (- "0" "9") (+ (- "0" "9")))]
[float (@ (number) "." (number))])
(define mylexer (lexer (letter (display "It's a letter"))
(float (display "It's a float"))
(number (display "It's a number"))
(digit (display "It's a digit"))))
Then I did in interactions:
Welcome to DrScheme, version 202.6-cvs25nov2002.
Language: Pretty Big (includes MrEd and Advanced).
> (mylexer (current-input-port))
23
. lexer: No match found in input starting with: 2
> (mylexer (current-input-port))
a
. lexer: No match found in input starting with: a
>
Any ideas on what might be my error?
Best regards,
--
Paulo J. Matos : pocm(_at_)mega.ist.utl.pt
Instituto Superior Tecnico - Lisbon
Software & Computer Engineering - A.I.
- > http://mega.ist.utl.pt/~pocm
---
Yes, God had a deadline...
So, He wrote it all in Lisp!