2 Commits

Author SHA1 Message Date
hazemKrimi 0cf2de1aa7 fix: readme 2026-04-30 12:56:19 +01:00
hazemKrimi 74d4536322 fix: handle non existing vm file passed as argument 2026-04-16 17:31:46 +01:00
2 changed files with 9 additions and 4 deletions
+4 -4
View File
@@ -1,10 +1,10 @@
# Jack VM Translator
This is a VM translator made as an assignment for the [Nand To Tetris Course: Part 2](https://nand2tetris.org/project07). It assumes that the VM files do not have errors for now.
This is a VM translator made as an assignment for the [Nand To Tetris Course: Part 2](https://nand2tetris.org/project07).
## Requirements
You need a C++ compiler and `make` to develop, build, and run this project.
You need GCC and `make` to develop, build, and run this project.
## Installation
@@ -38,6 +38,6 @@ make MODE=release
You will find the executable in the `out/` directory.
## Reference
## Testing
This project is based on the [Nand To Tetrass Course: Part 2](https://www.nand2tetris.org/).
You can download VM files to test the translator against from the [Nand To Tetris website](https://www.nand2tetris.org/software).
+5
View File
@@ -13,6 +13,11 @@
int process(std::string inputPath, std::string outputPath,
std::ios_base::openmode outputStreamMode, bool &init) {
if (!std::filesystem::exists(inputPath)) {
std::cerr << "File does not exist!" << std::endl;
exit(1);
}
std::ifstream ifs(inputPath);
std::ofstream ofs(outputPath, outputStreamMode);
std::string fileName = getFileNameFromFilePath(inputPath);