[plt-scheme] Learning Scheme Lexer

From: Paulo Jorge O. C. Matos (pocm at mega.ist.utl.pt)
Date: Mon Dec 9 21:16:07 EST 2002

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!



Posted on the users mailing list.