Nand2Tetris Hack assembler implemented in Rust
github.com
github.com
With that said ...
1) They respectfully ask that you not share your solutions, so as to ensure others have to figure it out or ask for help in the forums.
2) Why share the assembler specifically? That's probably the least difficult or interesting project, as it's mostly just translating the mnemonics to binary.
3) Holy code duplication! [A] Surely Rust allows you to break off a simpler structure that just represents the mapping from assembly to binary, and then you can have one loop that does the insert/to-owned on each element?
[A] https://github.com/tamuhey/hack-assembler-rust/blob/master/s...
While I agree that posting this publicly is less than appreciated, he is VERY enthusiastic about seeing implementations in interesting programming languages, as far as I can remember from my class (last year). I sent him a link to the original repo, which will now be dead.
Would you be interested in forwarding a private link of some sort? I could forward it over.
1. He is a very, very funny dude.
2. He has no tolerance for bullshit, and will be very quick to shut you up if you are making no sense.
3. Having said that, he is VERY nice, and always points you in the correct direction, even if you are deeply mistaken.
4. He was one of the first people to push for Java in CS schools in Israel, when he was the founding dean at the IDC [0]. This might seem like a weird thing to mention, but in hindsight it cemented the use of modern programming languages in academic curriculums here, which is not a small feat.
5. He has a deep appreciation for the application of Computer Science in the wild, the likes of which I have not seen in many CS professors. He seems like a coder by heart, and that's why - I think - Nand2Tetris speaks to many of us: It is a very theoretical book, presented in a maker-y type fashion: build, build, build. Love it.
[0] https://www.idc.ac.il/en/pages/home.aspx
P.S. If you have some way of assisting the bootcamp (financially or otherwise), drop them a line over at info@wecode.org.il. Donation of services will probably also be appreciated, if possible.
I think using a much stricter language like Rust would have saved me a lot of heartache.
In fact I was even trying to reimplement the hack cpu emulator provided in the course using rust and tui-rs. The main hurdle now is how I can emulate a 512x256 screen in the terminal.
I got to the assmebler exercise and really wanted to figure out how to implement it in the assembly language itself to see how that step was once taken. After that I was going to do the exercise in python.
I really should pick up that book again and just implement the assembler in python, so that I can move forward.
I love the book.
I did it in javascript. I didn't really miss typing. Although when things went wrong a lot of debugging was needed. But I think these were logic errors iirc. I'm not sure if typing would have helped.
In part two you build a stack-based virtual machine and then javaesq programming language, that is built on top of the assembler you built in part one.
The amount of ".to_owned()" just begs to use some kind of macro though.