https://github.com/yottahmd/n2t
Nand to Tetris in Go
https://github.com/yottahmd/n2t
Last synced: 3 months ago
JSON representation
Nand to Tetris in Go
- Host: GitHub
- URL: https://github.com/yottahmd/n2t
- Owner: yottahmd
- Created: 2024-03-24T04:47:28.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-06T13:45:58.000Z (over 1 year ago)
- Last Synced: 2025-06-22T19:53:48.539Z (4 months ago)
- Language: Go
- Homepage: https://zenn.dev/tacoms/articles/1a8e9e1bc81d68
- Size: 295 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Nand to Tetris Golang Implementation
Visit the Nand2Tetris website: http://nand2tetris.org/## Overview
The Nand to Tetris course explores key computer science concepts including operating systems, compilers, virtual machines, assemblers, and logic gates. This implementation is built in Go.

*The course overview picture from Nand to Tetris*## 1. Assembler Part
The Assembler translates assembly language code (`*.asm`) into machine code (`*.hack`).
For further reading, check out these articles:
- English: [Medium Article](https://medium.com/@yohata/understanding-computer-architecture-through-nand-to-tetris-implementing-an-assembler-in-go-df515e19a974)
- Japanese: [Zenn Article](https://zenn.dev/tacoms/articles/1a8e9e1bc81d68)### How to Run the Assembler Example:
How to run assembler on the example:
```sh
cd ./assembler
go run . ../examples/Pong/Pong.asm
```## 2. VM Translator part
The VM Translator converts Virtual Machine code (`*.vm`) into assembly code (`*.asm`).
### How to Run the VM Translator Example:
```sh
cd ./vm
go run . ../examples/Pong
```## 3. Compiler part
The Compiler converts code written in the Jack language (`*.jack`) into VM code (`*.vm`). The Jack language is a straightforward programming language developed by the creators of Nand to Tetris.
### How to Compile an Example Jack File:
```sh
cd ./compiler
go run . ../examples/Pong
```Note: The current version of the compiler does not implement operator precedence as this feature is not covered in the Nand to Tetris course. I may add this feature later when I have more time.