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

2011-06-23 Thread Danny Yoo
> Ok, understood.  I'll add the optimization section to the tutorial, and then > write a blog post for blog.racket-lang.org. Blog post written: http://blog.hashcollision.org/?p=114 It ended up being more of a history of the writing, more than a mini-tutorial. _

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

2011-06-22 Thread Sam Tobin-Hochstadt
On Wed, Jun 22, 2011 at 12:03 AM, Danny Yoo wrote: > > So it looks like a multiple of 4.  It would be nice if that constant > were smaller, but I'm still impressed that Racket gets even that > close, given how little time Racket takes to do the actual > compilation. Here are some more vague thoug

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

2011-06-21 Thread Robby Findler
Do brainfuck programs lend themselves to parallelism? If so, futures might help. Robby On Wed, Jun 22, 2011 at 12:03 PM, Danny Yoo wrote: >> Doh.  I screwed up again, and forgot the flag that enables JIT >> compilation here.  I'll regenerate the PyPy-driven bf evaluator by >> using: >> >>    $ p

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

2011-06-21 Thread Danny Yoo
> Doh.  I screwed up again, and forgot the flag that enables JIT > compilation here.  I'll regenerate the PyPy-driven bf evaluator by > using: > >    $ python ./pypy/pypy/translator/goal/translate.py --opt=jit example5.py > > and generate corrected numbers soon.  My apologies for being hasty. > F

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

2011-06-21 Thread Danny Yoo
> Ah, I see!  I missed the link to the tutorial that explained out to > generate the JITed versions of example1.py through example5.py.  Ok, > so I'll use > >    $ python ./pypy/pypy/translator/goal/translate.py example5.py > Doh. I screwed up again, and forgot the flag that enables JIT compilati

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

2011-06-21 Thread Danny Yoo
> Cool stuff, but you might want to compare to this example in PyPy: > >   http://morepypy.blogspot.com/2011/04/tutorial-part-2-adding-jit.html > > If you get numbers, please share them here! Ah, I see! I missed the link to the tutorial that explained out to generate the JITed versions of exampl

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

2011-06-21 Thread David Van Horn
On 6/20/11 5:37 PM, Danny Yoo wrote: For comparison, here are the numbers I'm seeing from the PyPy tutorial example1.py (using pypy b590cf6de419): fermi ~/local/pypy-tutorial $ echo 100 | time ~/local/pypy/bin/pypy example1.py prime.b Primes up to: 2 3 5 7 11 13 17 19 23 29 31 37 41 43

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

2011-06-20 Thread Danny Yoo
> It would be even better if you wrote it up as an optimization section. Ok. Added a preliminary draft of section 9.1, which talks about switching out the parameters used in the original implementation with syntax parameters. Also includes a brief tutorial on syntax parameters, because they're

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

2011-06-20 Thread Danny Yoo
>> You'd want to do the following: >>  - add some bounds checking in `increment-ptr' and `decrement-ptr'. >>  - change the `vector' operations to their `unsafe-vector' counterparts. >>  - change `sub1' and `add1' to use `unsafe-fx+' and `unsafe-fx-' >>  - change `=' to `unsafe-fx=' >>  - change the

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

2011-06-20 Thread Danny Yoo
> > You'd want to do the following: >  - add some bounds checking in `increment-ptr' and `decrement-ptr'. >  - change the `vector' operations to their `unsafe-vector' counterparts. >  - change `sub1' and `add1' to use `unsafe-fx+' and `unsafe-fx-' >  - change `=' to `unsafe-fx=' >  - change the use

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

2011-06-20 Thread Sam Tobin-Hochstadt
On Mon, Jun 20, 2011 at 1:46 PM, Danny Yoo wrote: > > 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 t

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

2011-06-20 Thread Danny Yoo
> On Mon, Jun 20, 2011 at 7:28 AM, Stephen De Gabrielle > 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 w

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

2011-06-20 Thread Shriram Krishnamurthi
On Mon, Jun 20, 2011 at 7:28 AM, Stephen De Gabrielle wrote: > there's also a discussion going on here: > > http://reddit.com/comments/i1slm ...of internet quality (that's an oxymoron). Shriram _ For list-related administrative tasks: http://li

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

2011-06-20 Thread Stephen De Gabrielle
there's also a discussion going on here: http://reddit.com/comments/i1slm On Tue, Jun 14, 2011 at 4:33 PM, Danny Yoo wrote: >>> 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 lin

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

2011-06-14 Thread Danny Yoo
>> 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. > > You want to use the --redirect-main

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

2011-06-14 Thread Sam Tobin-Hochstadt
On Tue, Jun 14, 2011 at 11:11 AM, Danny Yoo wrote: > 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

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

2011-06-14 Thread Danny Yoo
> 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 uploa

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

2011-06-14 Thread Grant Rettke
On Mon, Jun 13, 2011 at 12:36 PM, Danny Yoo wrote: > I've written a tutorial Thank you. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

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

2011-06-14 Thread Deren Dohoda
It was a very good read. Maybe too many parentheticals to avoid technical errors? It is hard to comment until I try it myself. In any case, I think I needed something exactly like this, so thank you very much. Deren On Jun 13, 2011 1:38 PM, "Danny Yoo" wrote: > I've written a tutorial about how t

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

2011-06-13 Thread Mark Engelberg
Excellent tutorial. This really helped me understand how to write a language with a non-lispy syntax within Racket. Thanks. _ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

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

2011-06-13 Thread Danny Yoo
On Mon, Jun 13, 2011 at 5:34 PM, Johnny Morrice wrote: > >> 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/pla

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

2011-06-13 Thread Johnny Morrice
> 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 > > Comments and suggestions would

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

2011-06-13 Thread Danny Yoo
I've written a tutorial about how to extend Racket so it supports different languages. Material on this topic already exists in the Guide, but I wanted to write an extended example that covers the gauntlet, from setting up the PLaneT development links, to writing the semantics and parser, to final