[plt-scheme] Learning Scheme Lexer
Hi Scott,
Thanks a lot. So that's why there's a warning in the parser-tools
documentation explaining this. :) Now I remember. Too late... anyway,
now I won't forget.
Best regards,
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
> (lexer
> (letter (display "It's a letter")))
> matches the string of characters l e t t e r.
> ((letter) (display "It's a letter"))
> matches whatever letter is defined to be.
>
> -Scott
>
> On Monday, December 9, 2002, at 07:16 PM, Paulo Jorge O. C. Matos wrote:
>
>> For list-related administrative tasks:
>> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>>
>> 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!
>
>
>
--
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!