Failing specs for Hack assembler

17 views
Skip to first unread message

Tom Stuart

unread,
Feb 22, 2015, 11:31:26 AM2/22/15
to Computation Club mailing list
Hi folks,

We’re meeting again on Tuesday (http://lanyrd.com/cchyzr) to discuss chapter six and implement an assembler for the Hack language.

In case it would save anyone some busywork, I’ve made a repo at https://github.com/computationclub/hack-assembler and populated it with some failing specs based on the API description in the book. There’s more info in the README.

I have no wish to spoil anyone’s fun or prejudice the nature of our exploration, so I’m happy to delete this repo if it turns out to be counterproductive (e.g. we decide to not implement the assembler in Ruby, or we decide that writing tests together would be a useful activity in itself), but I wanted to make it available for anyone who can’t attend on Tuesday and/or just wants to play around beforehand.

Cheers,
-Tom

Jamie White

unread,
Feb 22, 2015, 3:51:37 PM2/22/15
to Tom Stuart, Computation Club mailing list
I sadly can't make it on Tuesday (too busy panicking about upcoming conference talk) so this is super useful. Thanks Tom!
> --
> You received this message because you are subscribed to the Google Groups "London Computation Club" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to london-computatio...@googlegroups.com.
> To post to this group, send an email to london-comp...@googlegroups.com.
> To view this discussion on the web, visit https://groups.google.com/d/msgid/london-computation-club/8A900AE7-D958-44B8-8B2A-4D84102A84F4%40codon.com.
> For more options, visit https://groups.google.com/d/optout.

Joel Chippindale

unread,
Feb 24, 2015, 10:51:36 AM2/24/15
to Jamie White, Tom Stuart, Computation Club mailing list
Looks good.

I am afraid I can't make it tonight either (school stuff to deal with). Good luck with the next chapter and I'll see you all next time,

J.

Tom Stuart

unread,
Feb 25, 2015, 6:15:44 AM2/25/15
to Computation Club mailing list
On 22 Feb 2015, at 16:31, Tom Stuart <t...@codon.com> wrote:
> In case it would save anyone some busywork, I’ve made a repo at https://github.com/computationclub/hack-assembler and populated it with some failing specs based on the API description in the book. There’s more info in the README.

I hope some saint will write up last night’s meeting on the wiki, but in the meantime, here are brief links collating what I showed at the end of last night’s session. (I’ve consolidated everything into the computationclub/hack-assembler repo.)

Different implementations of the assembler:

* the one we wrote together: https://github.com/computationclub/hack-assembler/blob/master/bin/assembler
* my one from the weekend: https://github.com/computationclub/hack-assembler/blob/tomstuart/solution/bin/assembler (more enumerators, and more “object oriented”, whatever that means)

Different implementations of the parser:

* the one we wrote together: https://github.com/computationclub/hack-assembler/blob/master/lib/parser.rb
* my line-based one: https://github.com/computationclub/hack-assembler/blob/tomstuart/line-parser/lib/parser.rb (very similar, but with slightly more rejects)
* my token-based one: https://github.com/computationclub/hack-assembler/blob/tomstuart/token-parser/lib/parser.rb
* my Treetop-based one: https://github.com/computationclub/hack-assembler/blob/tomstuart/treetop-parser/lib/parser.rb
* my final one (hybrid of “line-based” and “token-based”): https://github.com/computationclub/hack-assembler/blob/tomstuart/solution/lib/parser.rb

I am curious about why the performance of these parsers is so wildly variable, and indeed whether the parser is actually the bottleneck, but don’t have the time/energy to profile them, so WHATEVER.

If any of the absentees (Jamie? Joel? James A?) manage to get their own implementation working, I’d encourage them to push it up to a branch on computationclub/hack-assembler so that we can compare and contrast.

Cheers,
-Tom

Tom Stuart

unread,
Feb 25, 2015, 6:24:27 AM2/25/15
to Computation Club mailing list
On 25 Feb 2015, at 11:15, Tom Stuart <t...@codon.com> wrote:
> * my line-based one: https://github.com/computationclub/hack-assembler/blob/tomstuart/line-parser/lib/parser.rb (very similar, but with slightly more rejects)

s/rejects/regexps/ (thanks autocorrect)
Reply all
Reply to author
Forward
0 new messages