Skip to content

Latest commit

 

History

74 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nand2tetris

nand2tetris

What is nand2tetris

"nand2tetris" (From Nand to Tetris) is a collection of projects that let student build a computer from scratch. It is a hands-on journey that starts with the most elementary logic gate, called Nand. and ends up, 12 projects later, with a general-purpose computer system capable of running Tetris. Specifically, the 12 projects are:

Navigation

  1. Boolean Logic
  2. Boolean Arithmetic
  3. Memory
  4. Machine Language
  5. Computer Architecture
  6. Assembler
  7. Virtual Machine I: Processing
  8. Virtual Machine II: Control
  9. High-Level Language
  10. Compiler I: Syntax Analysis
  11. Compiler II: Code Generation
  12. Opearting System

Part I: Hardware

Part I covers Project 1 to 6. In this part, we are going to implement the hardware architecture for our Hack computer. In particular, we are going to build:

  1. Logical gates: Project 1
  2. ALU and memory devices: Project 2 and 3
  3. Hack machine language: Project 4
  4. CPU and RAM: Project 5
  5. Hack assembler: Project 6

Part II: Software

Part II covers Project 7 to 12. In this part, we are going to implement Jack, a simple, Java-like, object-based programming language. As with programming languages like Java and C#, the Jack compiler will be two-tiered:

  1. The Hack compiler will generate interim bytecode, designed to run on an abstraction virtual machine (VM).
  2. The bytecode will then be compiled further by a separate VM translator into the Hack machine language.

Pictorially:

             Compiler            VM            Assembler
Source Code ---------> Bytecode ----> Assembly --------> Binary

The languaeg that we are going to implement, Jack, has the following syntax:

// First example in Programming 101
class Main {
  function void main() {
    do Output.printString("Hello World");
    return;
  }
}

In Part II, we are going to build:

  1. VM translator: Project 7-8
  2. BreakOut game written in Jack: Project 9
  3. Jack compiler: Project 10-11
  4. Operating system: Project 12

About

From Nand to Tetris: Building a Modern Computer From First Principles

Resources

Stars

11 stars

Watchers

2 watching

Forks

Contributors

Languages