Hacker News Comments on
Offered by Hebrew University of Jerusalem
Hacker News Stories and CommentsAll the comments and stories posted to Hacker News that reference this url.
nand2tetris teaches compilers backwards.
For that matter, they teach the whole computer backwards. Students start with NAND gates and implement a computer in a hardware definition language. They then implement an assembler for that hardware.
The next step is to implement a virtual stack machine, written in that assembler.
Then the students implement a compiler for an object-oriented language similar to Java. The target for the compiler is the stack machine language. This is done in two passes: lexing and a PEG compiler.
Finally, a simple OS is implemented.
In most courses, if you copy back what has been covered, you will have no problem completing the class. But in nand2tetris, some of the key material is omitted from each stage. You have to figure it out yourself.
Course is available for free on Coursera:
Part 1 - https://www.coursera.org/learn/build-a-computer (hardware projects/chapters 1-6)
Part 2 - https://www.coursera.org/learn/nand2tetris2 (software projects/chapters 7-12)
⬐ mikevmDo the lectures offer anything on top of just reading the book?⬐ bmitcThe downside is that part two is the software stack and the software grader only supports Python and Java.⬐ rbanffyIt's reasonable to support one great programming language along with Java, which is kind of a market standard.⬐ bmitc⬐ fantodI didn’t say it wasn’t reasonable, but it is a downside for those wanting to do something different.
I’d prefer they tested emitted code, that way you can use anything you want.⬐ rbanffyThey'd need to maintain trusted sandboxed environments for every supported compiler/interpreter. That's a lot of work.Not when I took it! I did most of those assignments in Haskell (a choice I came to regret). Double-checking and it seems the grader supports the following languages: C, C++, C#, Elixir, Erlang, Go, Haskell, Java, Lua, Node.js, Perl, PHP, Python 2.7, Python 3, Ruby, Rust, Scala, Swift.⬐ bmitcOh really? I was going off their own FAQ since the graded items requiring paying, and I didn’t want to do it if I couldn’t use the languages I wanted, namely F# and Racket.
From the FAQ:
> > Which programming language do I have to use in order to complete the assignments in this course?
> We expect learners to submit assignments in any version of Java, or Python. We will assume that you have basic programming ability in these languages, including a basic ability to understand and write simple object-based programs.
So is their FAQ out of date I guess?⬐ fantodYeah, I guess the FAQ is out of date. Think you should be to sign up for free if you want to check for yourself. I highly recommend it! And F# would be a pretty great language for this course, I think. Looks like no Racket (or any Lisp) support, though.⬐ bmitcYea, I have already done the first course part and then the assembler, which is in F# and linked in one of my other comments.
Thanks for letting me know about the extended grader support.
You are probably looking for the videos on coursera .
⬐ ngcc_hkThanks. Even though I am not the op
Nand to Tetris: how a computer is built from the ground up. Starting from nand logic gates all the way to OO programming
⬐ SilasXSeconding this. It's the most fun I've ever had on a technical project (with the possible exception of tptacek's microcorruption.com), and really opened my eyes to all the problems you have to solve to get a working computer.
Note: you can also complete all the course materials just by going to nand2tetris.org.
My presentation slides promoting nand2tetris to the Austin python group: https://docs.google.com/presentation/d/1fGf2eZVOM2lHL8hFVyd2...⬐ rskirkpatrickI am going to take this next! I am excited to see what it has to offer.⬐ TainnorHave never done the course, but I did work through the entire book some years ago and it was an intensely rewarding experience.⬐ TomteThe course is good, the book is better, in my opinion. Although it covers the same, but I like its presentation much better than the video course.
Nisam/Schocken: "The Elements of Computing Systems"
I have only finished the hardware part, so far, but skimming the rest I can't find Tetris anywhere. Is that really missing, although it's in the title?
(I know that you can program Tetris on the machine you build in the course, but is it an exercise somewhere?⬐ troupeOn Coursera, if I remember right, the first course gets you to the point where you have a CPU that can run machine language and an assembler. They give you an assembly version of Tetris that will run on what you built.
In the second course you build the programming language that could be used to write Tetris, though I don't think you actually go through it as an exercise.⬐ sn9The second edition of the book is actually slated for release in July. You can preorder it on Amazon.⬐ captn3m0One section asks you to learn Jack (The high-level programming language) by writing a medium-complexity program. The goal of the exercise is not to get proficient in Jack (which is a Java-like-language), but to just learn it well enough to implement the compiler.
I wrote a Tic-Tac-Toe variant - but you could write anything, including Tetris.
1. CS50 [difficulty level: medium, has certificate: Yes] https://www.edx.org/course/cs50s-introduction-to-computer-sc...
2. Algorithms [difficulty level: hard, has certificate: No] https://www.coursera.org/learn/algorithms-part1
3. Nand2Tetris [difficulty level: ok, has certificate: Yes] https://www.coursera.org/learn/build-a-computer
Build a Modern Computer from First Principles: From Nand to Tetris (Project-Centered Course) https://www.coursera.org/learn/build-a-computer
and then part 2: https://www.coursera.org/learn/nand2tetris2
[Both courses are free]
These are fantastic courses, by far the best MOOCs I have ever taken. I went into them knowing nothing about computer architecture, and by the end of the first course I was able to design a fully-working digital computer in Logisim.
While other courses consist of lectures + text content, with Nand2Tetris the course is practical. The authors have developed a complete software system to allow you to complete the course:
* A simplified hardware programming language to design the ALU, CPU, clock, RAM, etc..
* A hardware simulator and debugger to allow you to test the hardware that you develop
* An assembler for the assembly programs you write for the computer
* A compiler for the higher-level programs you write for the computer
I'm probably banging-on about this course more than I reasonably should, but that's just because I enjoyed the course so much!
⬐ zerrOh, I was hoping the development of an assembler and a compiler was a part of the course.
How useful would that course be for someone who knows about computer architecture, has coded in assembly, understands how compilers work, etc...?
Alternatively, would this course be useful/accessible for complete beginners, e.g. mid/high schoolers?⬐ hawkjoI have to also mention nandgame.com here. Similar idea, but all presented as an interactive, browser-based game. Start with nand gates and build up to a functioning computer. You never get to tetris, but it's great and super easy to start playing/learning. Delightful.⬐ polycasterhttp://nandgame.com/ You‘re welcome.⬐ credit_guyOh man, a big Thank You. I kind of know where I'll be spending 10-12 hours in the next few days.
>Learn whatever assembly language first
On this front, I can highly recommend these two resources, preferably in this order for someone totally new to assembly:
NAND to Tetris, a course that will have you build an emulated general-purpose CPU from first principles even with no prior knowledge. You'll learn exactly about registers and memory by making them. I even recommend this to non-hardware people because the way they divide each layer of complexity is great practice even in software. https://www.coursera.org/learn/build-a-computer
Microcorruption, a series of incrementally difficult MSP430 (an easy-to-understand 16-bit instruction set) exploitation exercises in the browser: https://microcorruption.com
These are both geared towards being a gentle introduction to assembly and CPU architecture principles. They don't touch certain facts of X86/64 processors like pipelining or variable-length instructions, but IMO those are best left until you're comfortable with the basics.
⬐ barbecue_sauceI also recommend Xeno Kovah's OpenSecurityTraining courses on YouTube, some of which are specifically dedicated to assembly. The audio quality can sometimes be pretty bad, but the information is good. Though they try to obfuscate things a little bit, these are clearly workshops given to researchers at Mitre, the CVE project maintainer.⬐ vips7L⬐ boneitishttp://opensecuritytraining.info/
For those interested.Little warning, Microcorruption may be no longer monitored at this time. Account registration is not automated.
A hacker I closely follow tried to play Microcorruption during a Twitch broadcast, and, to my great disappointment, he was unable to due to lack of response.⬐ vervus⬐ retsibsiLuckily their "Hall of Fame" is open for anyone to see. And some of the accounts in there are pretty obvious junk accounts with the usual junk passwords. Would probably take like 5 tries to "brute force" your way in, which given the context of the site would even seem fair game.⬐ boneitisI agree that just about nobody would care in spirit.
It should probably at least be explicitly noted by anyone considering doing so: I'm sure that's still super illegal.> NAND to Tetris
The book version is also great, and suitable for self-study if you prefer to learn that way: https://www.nand2tetris.org/book
+1 for Nand to Tetris.
As someone who came to computing through high level software and a little later than many (I wasn't dismantling appliances at age 5 like you hear in a lot of people's origin stories) this was a really empowering ground-up introduction to hardware architecture.
One of the few Coursera courses  I actually finished and found rewarding, challenging and fun throughout.
The first half of nand2tetris (projects 1-6), which corresponds to their first Coursera course is a great introduction to the digital side of electronics. The second half is more general purpose computer and OS specific but probably still pretty useful. I've only finished up to chapter 5 as of right now, so I can't say anything definite.
The best MOOC course I have taken this year is the one I'm currently doing. It is called nand2tetris  where you actually build a 16 bit computer all the way from nand gate. Along the journey you will be building the memory, operating system and also writing a compiler. You can follow my journey in tweets .
Another great course I'd recommend is Big History. Like nand2tetris,it gives you a great overview of the entire history of our being. From Big Bang to 2018.
Also, I am looking for some great online courses on Distributed systems. It would be good if assignments are challenging and where you have to write a lot of code.
 Nand2tetris: https://www.coursera.org/learn/build-a-computer
 My Nand2tetris journey in tweets: https://twitter.com/abiduzz420/status/1076192382398357505
 Big History Project: https://polymathgoodies.xyz/big-history-project/
Edit: added extra spaces
I have spent a lot of time taking online courses. Here are my favorites.
CS50 (https://www.edx.org/course/cs50s-introduction-computer-scien...) - Best Intro to Computer Science
Nand2Tetris I and II (https://www.coursera.org/learn/build-a-computer) - Build a computer from logic gates up to a compiler, this is the best class I've ever taken.
Agile Development Using Ruby on Rails (https://www.edx.org/professional-certificate/agile-developme...) - Great introduction to web development and software engineering principles
I've also been reading some technical books. Would definitely recommend
Modern Operating Systems - Tanenbaum Designing Data-Intensive Applications - Kleppmann
There's also a Coursera MOOC on Nand2Tetris:
I'm also a self-taught web dev, trying to learn more about the fundamentals. I've been trying to get through this course, and while the going is slow, it has been pretty incredible:
I'm not familiar with low-level, so I'm not sure how "low" you mean, but I've begun the NAND2Tetris course on coursera and it's pretty great so far. You basically implement a VM from scratch: https://www.coursera.org/learn/build-a-computer
⬐ jamesmcmWow I just did the same course this week too.
It's a great course. Though I ended up writing the assembler in Python rather than C.⬐ SilasXI actually took that early this year and LOVED it, and was looking for a good followup course. I was toying around with CS140e (also uses RPi 3 and Rust) but this one looks more appropriate.
This might seem like a roundabout way to start, but I'd recommend Code by Charles Petzold.
It starts out with just wires, switches, and relays, and as the book progresses he goes through the process of building up a simple CPU and RAM one step at a time. The book even walks you through coming up with opcodes and assembly language.
Even if you already know this stuff, I found the book was helpful in developing an intuitive feel for how everything works and fits together.
After reading it, you'd probably have a good mental model of how you'd want to approach writing an emulator.
The Nand to Tetris courses and their accompanying textbook would probably be helpful here too.
There is a book "The Elements of Computing Systems: Building a Modern Computer from First Principles" that is often called "From NAND to Tetris". This has you building a computer simulator from the ground up (NAND to Tetris). There is a website and a Cousera course. And a TED talk.
Handmade Nand2Tetris 
Nand 2 Tetris is a good starting place. You should get a good view of how the different level interact. Coursera have two cources  that cover the same material as the book
⬐ indigochillI second this course. It's awesome. The next step from there is probably Coursera's VLSI course, starting with https://www.coursera.org/learn/vlsi-cad-logic. It's all about how real-world VLSI CADs work.⬐ fstephanyThanks! I finished Nand2Tetris and was wondering where to look for a good next step.
I'll take a stab at a newb-friendly explanation, bearing in mind I'm only slightly less of a newb, but have at least studied this stuff to some extent and have played with https://microcorruption.com, which is a game about maliciously editing machine instructions. Onwards!
CPUs have a fixed instruction set. Add, subtract, increment by 1, and so on. These instructions in turn are represented in machine language as a binary string, which represents signals that get sent to the CPU's processing center, the ALU (Arithmetic Logic Unit). The ALU has a number of input ports, with each one corresponding to a different fundamental operation.
There are a number of programs capable of taking an executable and providing a step-by-step breakdown in machine language (which makes sense intuitively because the machine has to do this for itself anyway in order to execute the program). So once you have the machine language instructions, you then study it to see what different sets of instructions are doing. This is made somewhat easier by the fact that computers run through instructions linearly (with the exception of jumps, but you also know that jumps represent some sort of logic operating on input, so those are informative as well).
Although this would take forever to do manually, there are programs that aid in breaking machine language into easier-to-understand chunks, like IDA.
Anyway, once you understand what different chunks of instructions are doing, then you can decide how you want to alter the program. You can use a hex editor for the actual editing (I assume professionals use something different, but some game modders use hex editors), which simply lets you change the individual bits on your drive (if this sounds impressive, realize that every time you save a file or something, that's what's going on at a large scale).
If you want a gentle, newbie-friendly introduction to CPUs which will make a lot of this stuff click better, I highly recommend the NAND to Tetris course, which has a video series on Coursera: https://www.coursera.org/learn/build-a-computer
Pretty sure that's part of the first course (https://www.coursera.org/learn/build-a-computer), and this one starts above the hardware.
Also in MOOC form now too:
+1 to Code (Petzold). I would absolutely start with that. One of my favorite books. The build a computer course from coursera (https://www.coursera.org/learn/build-a-computer) is the natural next step after reading code.
Depending on how deep you want to go:
https://www.coursera.org/learn/build-a-computer - This is a fantastic no-prerequisites course that has you actually implementing a functional CPU in 6 weeks starting from building basic logic gates out of NAND gates. There's a hands-on project every week to help you solidify your understanding of the lectures. The resources are also all available at their site: http://www.nand2tetris.org/. In case that sounds intimidating, I have no formal CS education either and couldn't implement any of the basic logic gates before I took the course, and I built a CPU by the end so I'm confident others can too. They have a "Part 2" to this course which has you build from the CPU to a functional operating system which would get you an introduction to how kernels work in general, although they recommend some programming experience for that part.
Hacking: The Art of Exploitation - Despite the name, this book is actually an excellent introduction to low-level behavior both on the CPU and on networks (it's split into distinct sections to cover each topic). I would recommend picking this up after the course linked above, because it's somewhat brief with its explanation of CPU architecture. A beginner's course in C programming might also be advisable since this does use some basic C code which might be challenging if you've never been exposed to it before.
I am taking a great coursera course on the very basics of a computer (uses a hardware simulator to build the chipsets necessary to build a computer). It is VERY intro-friendly and gentle, including teaching basic Boolean algebra. Also can be very hands on, which is what I really like about it. Might be a good fit!
+1, along with the author's course "Build a Modern Computer from First Principles: From Nand to Tetris" https://www.coursera.org/learn/build-a-computer
Working through the class on Coursera now, and it's a lot of fun. https://www.coursera.org/learn/build-a-computer
⬐ petraI wonder if, in that same spirit, it's possible to make building, together , a complex microcontroller , a fun project ?⬐ Graziano_MThat classes basically builds a microcontroller. It's Harvard Architecture with a split iROM and dRAM. Simple ALU, 16 bit CPU. You'd need one hell of a bread board to physically build it, though.⬐ DangerangerWell there is the FAP80 now. https://github.com/dekuNukem/fap80 https://dekunukem.wordpress.com/
⬐ jwhitlarkIf you are self taught, you owe it to yourself to take this course. It's the best tie together class I've ever seen, and made a world of difference to me.
Note that this is one the first half of the coursework, I'm still waiting for the second part.
Seriously, if you're self taught, and have been writing code for a while, this and a great compiler course will take you to a new level.⬐ ellius⬐ wccrawfordI'm self-taught. This was the first book that actually answered my question "but how does it work?". I'd been getting incomplete and misguided answers for years when I finally stumbled across this book in an HN thread, and I was finally able to put the full picture together.I did a course based on this book a while back, and while I didn't quite finish it, I did get a lot of enjoyment from it.
I think I probably did it here. Or at least used this page as reference.⬐ bbayerFor some background https://www.youtube.com/watch?v=iE7YRHxwoDs⬐ throwaway2016aI had avery similar course to this in college. We build a 4-bit machine (with a very limited instruction set) from scratch (well from basic logic gates and RAM). For the final project grade the professor ran a test program through it and saw if the output matched what was expected.
We actually physically built it on a breadboard.
It was fun and I learned a lot. Hopefully this is a similar experience for those who take it.⬐ iosephLooks like an interesting course, though the submission process seems unpleasant compared to other courses I've taken in the past.⬐ temp-defualtAmazing... I really love this course. I teach it to my students it is great!⬐ busterarmI've been going through the book and it's been great fun so far.
Recommend!⬐ fieryskiffInteresting. Anyone know if it's updated from ? Wonder if it'll just use the same Software. The book  was interesting.⬐ ioseph⬐ chairmanwowLooks like it's still the same course although with video lectures added⬐ guiambrosI finished it a couple of months ago. It uses the exact same structure and software as described in the book (HACK language, etc).
The included hands-on projects made it more fun and interesting. Basically you'll build a simple computer from the ground up, starting with flip-flops and going all the up up to ALU, memory and CPU.
The grader works well, so you can submit your code and it'll grade you in realtime. You can finish it in less than a month, if you have experience with electronics and Boolean logic.⬐ Patrick_DevineI've gone through the book and got as far as building the computer, writing the assembler and running some programs on it. Does the course go beyond this? I haven't built the virtual machine or written the compiler, but it looked like from the description of the course, they didn't do that either.⬐ dan1234According to the Nand2Tetris site, this is just part 1 and only covers chapters 1-6. Part 2 will cover chapters 7-12 but looks to be still in development.> Course by Hebrew University of Jerusalem
> Project 1 due December 25th⬐ rkachowskiSadly it looks like the course stops at week 6 after the assembler has been implemented. The next steps in the book are to implement the VM, compiler and develop programs in the high level language you've implemented.
I started the book back in August and got as far as implementing the lexical analysis in the compiler, I was kinda hoping this course would give the the push to finish everything.
The authors also created a course on Coursera  which is also worth a look. Although it only covers the first half of the book (up to Assembler Language.) The authors have promised part 2 but it hasn't been released yet.
I really like nand2tetris  in which one builds a computer from NAND gates upwards. You build the ALU etc., an assembler, compiler, a OS and VM on which you can run your own version of tetris, snake, whatever. It doesn't teach programming directly, but could be used to teach programming when the first parts are reached that require programming (I believe it was Chapter 6 - Assembler).
The hardware part of the course is also available on coursera now.  Previous discussion on hn .
Thanks to the author for the heads up, would be real shame if these courses are removed without someone downloading all the material first (I don't care if it's against the ToS, I still think a torrent is the way to go, free education has a greater value than copyright protection).
I'm a bit confused about which courses will be removed and which ones will stay. Is there a list of courses that are present on the old platform but not on the new platform? Also, I don't know where I'd access the old platform and where I'd access the new platform. Am I right in thinking this is a course on the new platform?
If so, where do I go to see the old platform?
Cool, haven't thought about that. I probably need to get an FPGA. Really liked the book "The Elements of Computing Systems"  in which one builds a computer from NAND gates upwards, a compiler, vm and finally a simple OS with applications. The hardware part of the course seems to be on coursera now as well. 
⬐ nickpsecurityThat's some really neat stuff that I somehow missed in prior research. Thanks for the links. I'm particularly going to have to take another look at the paper that details their methodology for building systems ground up. The abstraction process and samples.
I just finished the course from coursera https://www.coursera.org/course/nand2tetris1. It is a very good start learning from the course or from the book for those who are interested to build something like this. I highly recommend it.
Sometimes I do find programmers that do not know how to, say, install a linux distro, or at a lower level, don't understand what a data bus is, or how one bit of information is actually stored in a computer.
> Learning how to make car parts from scratch gives younger workers insights they otherwise wouldn’t get from picking parts from bins and conveyor belts, or pressing buttons on machines.
This is also the spirit of the nand2tetris  course, currently running on coursera . The book is a really entertaining read too. Depending on how familiar you are with electronics you may be able to outpace the video course quite a bit.
> “Fully automated machines don’t evolve on their own,”
not yet... :p
⬐ gregpillingI know a computer science professor that asked me how to make a website as recently as 2007⬐ kwhitefootNot entirely sure what your point is here but I assume that you mean he should have known.
Can't imagine why a computer SCIENCE professor would be expected to know how to make a website any more than my Newtonian mechanics professor would have been expected to know how to build a car.