6 ms·
Nand2Tetris Hack assembler implemented in Rust
- stillmotion 6y agoNice! I did this too[0], I highly recommend the exercise. [0] https://github.com/levi/hackassembler https://github.com/levi/hackassembler
- alexgmcm 6y agoI did Nand2Tetris in Python as it was what I was familiar with at the time. I think using a much stricter language like Rust would have saved me a lot of heartache.
- mastrsushi 6y ago(Thing you normally wouldn't care about)...implemented in Rust.
- nurettin 6y agoImplemented in Rust/Python/Elixir
- AnanasAttack 6y agoIt seems anything is newsworthy here when it's in Rust
- aparsons 6y agoUpvote Collector.... implemented in Rust!
- barking 6y agoI did it in VB6
- ducaale 6y agoI have also implemented this exercise in rust although the one posted here is much cleaner in terms of code. 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.
- gitgud 6y agoNext you'll have to implement a Rust compiler in Hack!
- shayas 6y agoGreat course! I had the pleasure of doing it with the mentoring of Prof. Schocken in Israel (and being graded on it... :) )
- stormdennis 6y agoLucky you to have great teacher.
- tomgs 6y agoSame as shayas above - took his class in school. Some impressions from talking to him and working with him in his coding bootcamp: 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 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.
- tryum 6y agoIs this part of the second half of the course ? I don't remember implementing an assembler, but I only did the 1st half ;)
- tamuhey 6y agoIt is the last project in the 1st half
- tarkin2 6y agoThe end of the first part. Although it's optional. In the start of part two they make you do it if you skipped it in part one. 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.
- SilasX 6y agoAs always, I can't recommend this course enough, it's a really enlightening dive through the layers that make up a computer, and I presented about my experience with it at a Python meetup. 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/src/main.rs#L11 https://github.com/tamuhey/hack-assembler-rust/blob/master/s...
- tamuhey 6y agoI followed your advice and closed my repo.
- tomgs 6y agoI was also a student of Prof. Schocken's in person, as well as part of the tech crew for a non-profit coding bootcamp he set up[0]. 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. [0] https://wecode.org.il/ https://wecode.org.il/
- pjmlp 6y agoNice work. The amount of ".to_owned()" just begs to use some kind of macro though.
- SilasX 6y agoYeah I'd appreciate if a rustacean would explain the canonical way of DRYing that up, at least if it's non-obvious, something other "run a loop over a variable holding the dictionary literal".
- gtsnexp 6y agoAnyone else having trouble running it?
- mywittyname 6y agoI'm seeing a 404 now.
- InfiniteBeing 6y agoLast year I was going through this book because I always wanted to know how computers were made from the ground up. 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.