mirror of
https://github.com/hazemKrimi/jack-vm-translator.git
synced 2026-05-02 02:10:27 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cf2de1aa7 | |||
| 74d4536322 |
@@ -1,10 +1,10 @@
|
|||||||
# Jack VM Translator
|
# 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
|
## 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
|
## Installation
|
||||||
|
|
||||||
@@ -38,6 +38,6 @@ make MODE=release
|
|||||||
|
|
||||||
You will find the executable in the `out/` directory.
|
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).
|
||||||
|
|||||||
@@ -13,6 +13,11 @@
|
|||||||
|
|
||||||
int process(std::string inputPath, std::string outputPath,
|
int process(std::string inputPath, std::string outputPath,
|
||||||
std::ios_base::openmode outputStreamMode, bool &init) {
|
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::ifstream ifs(inputPath);
|
||||||
std::ofstream ofs(outputPath, outputStreamMode);
|
std::ofstream ofs(outputPath, outputStreamMode);
|
||||||
std::string fileName = getFileNameFromFilePath(inputPath);
|
std::string fileName = getFileNameFromFilePath(inputPath);
|
||||||
|
|||||||
Reference in New Issue
Block a user