[racket] Using lex and yacc

From: Eduardo Bellani (ebellani at gmail.com)
Date: Fri Oct 15 15:52:01 EDT 2010

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I've just completed a small example for a logo like language using the
parser tools. Take a look at files mech.rkt and test-mech.rkt here:
http://github.com/ebellani/robo

If you have any doubts just ask.

On 10/12/2010 03:12 PM, Mark Carter wrote:
> Are there any examples on using lex and yacc, as I'm having trouble getting 
> started. I am trying to write a simple calculator. Here's what I've got so far:
> 
> #lang racket/base
> 
> (require parser-tools/lex)
> 
> (define lex (lexer
>              ((:+ "[0-9]") (values 'int (string->number lexeme)))
>              ((:+ whitespace) null)
>              ((:: "+") (values 'plus 0))
>              ((:: "-") (values 'minus 0))
>              ((:: "*") (values 'mult 0))
>              ((:: "/") (values 'div 0))))
> 
> When I try to compile it, I get
>    regular-expression: undefined operator in: (:+ "[0-9]")
> How do I correct this?
> 
> 
> 
>       
> _________________________________________________
>   For list-related administrative tasks:
>   http://lists.racket-lang.org/listinfo/users


- -- 
Eduardo Bellani

omnia mutantur, nihil interit.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAky4sOEACgkQSbLl0kCTjGkhewCePnzwLnlvzK/hVxKawsMIiqhx
z5YAn23BpOnmpaxiasgBAHq+1t7qCXix
=HkOP
-----END PGP SIGNATURE-----


Posted on the users mailing list.