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

From: Danny Yoo (dyoo at cs.wpi.edu)
Date: Tue Jun 14 11:11:39 EDT 2011

> The dilemma was to choose a language that was simple, and looked
> nothing like Racket.  The choice was clear: it had to be brainf*ck.
> Here's the tutorial:
>
>    http://planet.racket-lang.org/package-source/dyoo/bf.plt/1/2/planet-docs/manual/index.html


One thing that I want to do is upload it somewhere more permanently,
and to have all the documentation links work.  None of the
Racket-bound documentation links are working, and I'd like to redirect
those links off to docs.racket-lang.org instead.


At the moment, I've put the content generated by locally running Scribble into:

    http://hashcollision.org/brainfudge/

and resorting to a hack with JQuery to replace all of the broken
links.  Here's the simple hack:

<DOCTYPE html>
<html>
<head><title>F*dging up a Racket</title></head>
<body>
</body>
<script src="/js/jquery-1.6.1.min.js"></script>
<script>
$(document).ready(function() {
    var regexp = new
RegExp("^file:///research/plt/software/racket/5.1.1/std/doc/");
    $(document.body).load('manual.html', function() {
            $(document.body).find("a").each(function() {
                 this.href = this.href.replace(regexp,
                                               "http://docs.racket-lang.org/");
            });
        });
});
</script>
</html>


I suppose this "works", but I feel dirty.  :)



Posted on the users mailing list.