{"id":34553053,"url":"https://github.com/veryshyjelly/hack_assembler","last_synced_at":"2026-06-05T09:31:10.204Z","repository":{"id":243366521,"uuid":"812236878","full_name":"veryshyjelly/hack_assembler","owner":"veryshyjelly","description":"Implementation of hack assembler in Rust","archived":false,"fork":false,"pushed_at":"2025-09-19T07:35:19.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-07T14:39:19.232Z","etag":null,"topics":["hack-assembler","nand2tetris","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veryshyjelly.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-06-08T10:20:38.000Z","updated_at":"2025-09-19T07:35:24.000Z","dependencies_parsed_at":"2025-01-31T06:42:27.831Z","dependency_job_id":null,"html_url":"https://github.com/veryshyjelly/hack_assembler","commit_stats":null,"previous_names":["veryshyjelly/hack_assembler","tsych0/hack_assembler","burningcandle69/hack_assembler"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/veryshyjelly/hack_assembler","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veryshyjelly%2Fhack_assembler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veryshyjelly%2Fhack_assembler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veryshyjelly%2Fhack_assembler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veryshyjelly%2Fhack_assembler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veryshyjelly","download_url":"https://codeload.github.com/veryshyjelly/hack_assembler/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veryshyjelly%2Fhack_assembler/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27998473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hack-assembler","nand2tetris","rust"],"created_at":"2025-12-24T08:06:17.544Z","updated_at":"2025-12-24T08:06:28.055Z","avatar_url":"https://github.com/veryshyjelly.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hack Assembler\n\n## Introduction\n\nThis project is an implementation of the Hack Assembler, written in Rust. The Hack Assembler translates Hack assembly\nlanguage into Hack machine language, which can be executed on the Hack computer described in the \"From NAND to Tetris\"\ncourse.\n\n## Hack Assembly Language\n\nThe Hack assembly language is a simple, low-level programming language designed for the Hack computer. It consists of\ntwo types of instructions:\n\n1. **A-instructions**: Used to set the value of the A register.\n    - Syntax: `@value`\n    - Example: `@21` sets the A register to 21.\n\n2. **C-instructions**: Used for computations and memory access.\n    - Syntax: `dest=comp;jump`\n    - Example: `D=M+1;JGT` sets D to M+1 and jumps if greater than zero.\n\n### Hack Assembly Language Contract\n\n- **A-instructions (`@value`)**:\n    - `value` can be a non-negative decimal number or a symbolic label.\n    - The value sets the address in the A register.\n\n- **C-instructions (`dest=comp;jump`)**:\n    - `dest` (optional): Specifies the destination (A, D, M) where the result of the computation is stored.\n    - `comp`: Specifies the computation to be performed (\n      e.g., `0`, `1`, `-1`, `D`, `A`, `M`, `D+1`, `A-1`, `M-1`, `D+M`, etc.).\n    - `jump` (optional): Specifies the jump condition (JGT, JEQ, JGE, JLT, JNE, JLE, JMP).\n\n## Features of the Hack Assembler\n\n- **Symbol Handling**: Supports symbols for variables and labels.\n- **Error Checking**: Provides informative error messages for syntax errors and undefined symbols.\n- **Optimized Code**: Generates efficient Hack machine code.\n- **User-Friendly CLI**: Easy-to-use command-line interface for assembling `.asm` files.\n\n## Installation\n\nTo use this assembler, you'll need to have Rust installed on your machine. If you don't have Rust installed, you can get\nit [here](https://www.rust-lang.org/tools/install).\n\nClone the repository and navigate to the project directory:\n\n```sh\ngit clone https://github.com/veryshyjelly/hack-assembler.git\ncd hack-assembler\n```\n\nBuild the project using Cargo:\n\n```sh\ncargo build --release\n```\n\nThe executable will be located in the `target/release` directory.\n\n## Usage\n\nTo assemble a Hack assembly file, run the following command:\n\n```sh\n./hack-assembler path/to/yourfile.asm\n```\n\nThis will generate a binary file with the same name as the input file but with a `.hack` extension, which contains the\nHack machine code.\n\n## Example\n\nGiven the following Hack assembly code in `example.asm`:\n\n```asm\n// Adds 1 + ... + 100\n@i\nM=1\n@sum\nM=0\n(LOOP)\n@i\nD=M\n@100\nD=D-A\n@END\nD;JGT\n@i\nD=M\n@sum\nM=M+D\n@i\nM=M+1\n@LOOP\n0;JMP\n(END)\n@END\n0;JMP\n```\n\nRunning the assembler:\n\n```sh\n./hack-assembler example.asm\n```\n\nWill produce the following `example.hack` file:\n\n```plaintext\n0000000000010000\n1110110000010000\n0000000000010001\n1110101010001000\n0000000000010000\n1111110000010000\n0000001100010100\n1110010011010000\n0000000000010010\n1110001100001000\n0000000000010000\n1111110000010000\n0000000000010001\n1111000010001000\n0000000000010000\n1111110111001000\n0000000000010010\n1110101010000111\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue if you have any improvements or\nbug fixes.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- The creators of the \"From NAND to Tetris\" course, Noam Nisan and Shimon Schocken, for providing the framework and\n  inspiration for this project.\n- The Rust community for their excellent documentation and support.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveryshyjelly%2Fhack_assembler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveryshyjelly%2Fhack_assembler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveryshyjelly%2Fhack_assembler/lists"}