[racket] Tutorial: writing a language (brainf*ck) in Racket

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Mon Jun 20 13:46:09 EDT 2011

> On Mon, Jun 20, 2011 at 7:28 AM, Stephen De Gabrielle
> <stephen.degabrielle at acm.org> wrote:
>> there's also a discussion going on here:
>>
>> http://reddit.com/comments/i1slm
>
> ...of internet quality (that's an oxymoron).


Still, I'd be delighted if people upvoted the link.  :)


I did notice that the Reddit discussion was getting _very_ sidetracked
by performance issues.  So I changed a few things in my internal
implementation to make it perform competitively at least with the PyPy
example.  Hopefully that will help quell the concerns about
performance, and put the focus back on the tutorial.


In more detail: the key performance issue was the inefficient use of
parameters.  I had wanted to make sure I was using a fresh state per
module, so I had set up a parameter called 'current-state' that was
parameterized over the body of the module.  It turns out that this is
not an efficient way to scope the state to the module's body.  As an
alternative, I replaced this with a use of the syntax-parameterize
form in the racket/stxparam library, and that improved performance
quite a bit.


Posted on the users mailing list.