You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,20 @@
1
1
# NTU Introduction to Computer 2023 Fall Final Project - Assembler & VM Translator
2
2
3
-
In this final project, I implemented projects 6 through 8 of the textbook, namely the Hack assembler and VM-to-Hack translator. I chose C++ as my programming language and opted for an object-oriented approach, not fully complying with the suggestions from the textbook.
3
+
Author: B12902110 呂承諺 (100% contribution)
4
+
5
+
For the full commit history of the programs in this project, see [my main nand2tetris repository](https://github.com/gpwaob92679/nand2tetris).
6
+
7
+
## Abstract
8
+
9
+
In this final project, I implemented projects 6 through 8 of the textbook, namely the Hack assembler and VM-to-Hack translator. I chose C++ as my programming language and opted for an object-oriented design approach, not fully complying with the suggestions from the textbook.
4
10
5
11
I learned several software development tools through the process of doing this project. [CMake](https://cmake.org/), a cross-platform build system generator, is used to build this project, as it allows code to be compiled on various platforms with different compilers, and also simplifies testing and binary distribution. I chose [Abseil](https://github.com/abseil/abseil-cpp) as my support library, utilizing it's logging library, flags library and string utilities. For unit testing, [GoogleTest](https://github.com/google/googletest) is the framework of choice.
6
12
13
+
Possible future improvements include:
14
+
- Automated testing of the assembler
15
+
- Produce better error and warning messages from the assembler and the VM translator
16
+
- Optimize generated VM code (for example, when `index` is 0 or 1 for `push` and `pop` commands)
17
+
7
18
## Assembler
8
19
9
20
assembler - An assembler for the Hack platform.
@@ -59,7 +70,7 @@ vmtranslator [-v] [-d] SOURCE
59
70
-`-v`: Verbose output. Print translated assembly code to console.
60
71
-`-d`: Debug mode. Write VM source lines as comments in assembly output.
61
72
62
-
If *`SOURCE`* is a single VM file (for example, `MyProgram.vm`), the translator will output the assembly file in the same directory as *`SOURCE`* (for example, `Program.asm`). If *`SOURCE`* is a directory (for example, `MyProgram`), the translator will gather and translate each VM file under the directory and output the assembly file under the directory (for example, `MyProgram/MyProgram.asm`).
73
+
If *`SOURCE`* is a single VM file (for example, `MyProgram.vm`), the translator will output the assembly file in the same directory as *`SOURCE`* (for example, `Program.asm`). If *`SOURCE`* is a directory (for example, `MyProgram`), the translator will gather and translate each VM file in the directory and output the assembly file in the directory (for example, `MyProgram/MyProgram.asm`).
63
74
64
75
### Description
65
76
@@ -79,7 +90,7 @@ The main program drives the entire translation using the other 3 modules. It has
79
90
80
91
- CMake 3.20 or later
81
92
- A C++ compiler supporting at least C++17
82
-
- A Java runtime environment that can run nand2tetris's CPU emulator (used in testing)
93
+
- A Java runtime environment that can run nand2tetris's CPU emulator (used in a portion of tests)
0 commit comments