Skip to content

Latest commit

 

History

History
executable file
·
45 lines (37 loc) · 4.9 KB

README.md

File metadata and controls

executable file
·
45 lines (37 loc) · 4.9 KB

nand2tetris

My solutions to the nand2tetris course on building a computer system, starting only with NAND logic gates and ending with a working game of 2048:

Projects

Project Title Languages Notable Work
1
2
3
Boolean Logic
Boolean Arithmetic
Sequential Logic
HDL - ALU
4 Machine Language Hack assembly - Fill.asm
5 Computer Architecture HDL - CPU
6 Assembler Python - Assembler
7
8
VM I: Stack Arithmetic
VM II: Program Control
Python - VM translator
- Assembly code generation
9 High-Level Language Jack - 2048 game main loop
- 2048 game board manipulation and rendering
10
11
Compiler I: Syntax Analysis
Compiler II: Code Generation
Python - VM compilation engine
- Jack tokenizer
- Symbol table
- VM writer
- Helper functions and utils
12 Operating System Jack - OS Memory module with basic defrag support

Reference for languages used

Language Extension Description
HDL .hdl A hardware description language for describing circuits of logic gates.
Hack machine .hack A 16-bit machine language for the Hack computer, a von Neumann platform with CPU, instruction memory, data memory, and memory-mapped screen and keyboard for I/O.
Hack assembly .asm A human-readable assembly language for the Hack machine language.
VM .vm The language associated with the stack-based virtual machine as specified in The Elements of Computing Systems chapters 7 and 8.
Jack .jack A high-level, object-based programming language inspired by languages like Java or C#.

Note

The code (especially Python) may not be 100% polished and will trigger linters, with issues such as the following.

  • inconsistency with case types when naming functions and attributes (e.g. compileClass vs current_token)
  • unused imports and names (e.g. here and here)
  • f-strings with no placeholders (e.g. in here)
  • lines that have been commented out that will never be used (e.g. here)

Based on the Nand2tetris Software Suite.