[racket] Using lex and yacc

From: Paulo J. Matos (pocmatos at gmail.com)
Date: Wed Oct 20 09:28:34 EDT 2010

Also try:
http://www.codaset.com/pmatos/eboc/source/master/blob/eventb-parser.rkt

It's a parser for the formal language Event-B.

Cheers,

PMatos

Eduardo Bellani <ebellani at gmail.com>
writes:

> 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

-- 
PMatos



Posted on the users mailing list.