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