Re: [racket] Using lex and yacc

2010-10-12 Thread Jean-Paul Roy
Hi Mark ! I just wrote a book on teaching Racket programming (in French !) with a chapter 15 devoted to LeX/Yacc parsing. Rather simple, but should be efficient for the first steps. Here is the table of contents : http://deptinfo.unice.fr/~roy/PCPS/sommaire.pdf -jpr ___

Re: [racket] Counter servlet

2010-10-12 Thread Jay McCarthy
(a ([href ,what-you-have]) "link text") Jay On Tue, Oct 12, 2010 at 3:29 PM, Mark Carter wrote: > I thought I'd try to implement a stateful counter web app using DrRacket. > Here's > my code: > > #lang racket > > define a really simply counter > > > ;;; required libraries > (require web-se

[racket] Counter servlet

2010-10-12 Thread Mark Carter
I thought I'd try to implement a stateful counter web app using DrRacket. Here's my code: #lang racket define a really simply counter ;;; required libraries (require web-server/formlets web-server/servlet web-server/servlet-env) (define (counter request) (let ((coun

Re: [racket] Lesson from the macro exercise

2010-10-12 Thread Jens Axel Søgaard
2010/10/12 Jens Axel Søgaard : > Syntax/parse looks great! > > I haven't played with it before, but it I like the approach. > Two questions: > >   1. What does the error >          pattern: attribute has wrong depth (expected 0, found 1) in: d >      mean?  The program belows gives this error. I f

Re: [racket] Using lex and yacc

2010-10-12 Thread Sam Phillips
On Tue, Oct 12, 2010 at 11:12 AM, 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 >    

Re: [racket] Lesson from the macro exercise

2010-10-12 Thread Matthias Felleisen
I like the recipe. May I suggest some additions: 1. Formulate a purpose statement. 2. Write down a grammar for the surface syntax. 3. Describe the semantics informally, along the lines of what a ref man would contain. Then follow the steps below. And yes, syntax-parse über alles. -- Matt

Re: [racket] Using lex and yacc

2010-10-12 Thread Jay McCarthy
The documentation: http://docs.racket-lang.org/parser-tools/Converting_yacc_or_bison_Grammars.html says: "Annotated examples are in the "examples" subdirectory of the "parser-tools" collection." That is online here: http://git.racket-lang.org/plt/tree/HEAD:/collects/parser-tools/examples Jay

[racket] Using lex and yacc

2010-10-12 Thread Mark Carter
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)))

Re: [racket] Handling errors from in-directory - and handling errors more generally

2010-10-12 Thread Matthias Felleisen
Peter could roll his own in-directory recursive function in just a few line catching the relevant exceptions: > (define (traverse d) > (parameterize ([current-directory d]) > (define d (directory-list)) > (for-each (lambda (x) > (printf "~a " x) > (defi

Re: [racket] Lesson from the macro exercise

2010-10-12 Thread Jens Axel Søgaard
Syntax/parse looks great! I haven't played with it before, but it I like the approach. Two questions: 1. What does the error pattern: attribute has wrong depth (expected 0, found 1) in: d mean? The program belows gives this error. 2. Why is datum not a pre-defined syntax-cl

Re: [racket] Handling errors from in-directory - and handling errors more generally

2010-10-12 Thread Matthew Flatt
At Tue, 12 Oct 2010 14:48:49 +0100, Peter Kiggins wrote: > [I am completely new to both Scheme and racket, so if my questions are > Looking at traversal of a file tree led me to in-directory.  The > problem is that as soon as it hits a directory it cannot search > (permissions, whatever...) it drop

[racket] convert string to evaluatable code

2010-10-12 Thread 김태윤
hello I have made kind of calculator as like following code #lang scheme (define ns (make-base-namespace)) (define (calc) (let ((expression (read))) (if (eq? expression 'exit) (exit) (printf "~A ~n" (eval expression ns (calc)) (calc) since I learned big-bang function, I

[racket] Handling errors from in-directory - and handling errors more generally

2010-10-12 Thread Peter Kiggins
[I am completely new to both Scheme and racket, so if my questions are easily answered by reading some documentation, please just point me at it.] Looking at traversal of a file tree led me to in-directory.  The problem is that as soon as it hits a directory it cannot search (permissions, whatever

Re: [racket] I got an error on jaymccarthy/chipmunk example

2010-10-12 Thread Jay McCarthy
The Chipmunk API has changed since the package was written. You'll have to go back an older version. Probably one from last summer. Jay On Mon, Oct 11, 2010 at 11:56 PM, 장유현 wrote: > I'll really happy if someone help me.. > > My environment is Windows XP. and I downloaded Chipmunk 5.3.2 > > an

Re: [racket] Lesson from the macro exercise

2010-10-12 Thread Robby Findler
syntax/parse! :) Robby On Tue, Oct 12, 2010 at 3:46 AM, Jens Axel Søgaard wrote: > There have now been several solutions to the macro exercise. > Is there a systematic approach of deriving a solution? > > Here are some steps that could be included in a macro writing recipe. > > 1.  Write some e

[racket] Lesson from the macro exercise

2010-10-12 Thread Jens Axel Søgaard
There have now been several solutions to the macro exercise. Is there a systematic approach of deriving a solution? Here are some steps that could be included in a macro writing recipe. 1. Write some examples with their expected results. Remember corner cases (Get to know the semantics