{"id":29308794,"url":"https://github.com/benja2998/batch","last_synced_at":"2026-05-19T10:31:44.117Z","repository":{"id":301489783,"uuid":"1009409626","full_name":"benja2998/batch","owner":"benja2998","description":"Batch compiler","archived":false,"fork":false,"pushed_at":"2025-07-01T02:11:57.000Z","size":86,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-07T07:17:06.151Z","etag":null,"topics":["asm","bat","bat2exe","batch","batch-script","batchfile","batchfile-lang","compiler","good-first-issue","nasm","powershell","rust","rust-lang","scoop","script","skid","skids","skids-welcome","x86-64"],"latest_commit_sha":null,"homepage":"https://benja2998.github.io/batch/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benja2998.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-27T04:57:11.000Z","updated_at":"2025-07-01T03:22:22.000Z","dependencies_parsed_at":"2025-06-30T00:26:05.756Z","dependency_job_id":null,"html_url":"https://github.com/benja2998/batch","commit_stats":null,"previous_names":["benja2998/compiler.bat","benja2998/batch"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/benja2998/batch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benja2998%2Fbatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benja2998%2Fbatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benja2998%2Fbatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benja2998%2Fbatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benja2998","download_url":"https://codeload.github.com/benja2998/batch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benja2998%2Fbatch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269085240,"owners_count":24357190,"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-08-06T02:00:09.910Z","response_time":99,"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":["asm","bat","bat2exe","batch","batch-script","batchfile","batchfile-lang","compiler","good-first-issue","nasm","powershell","rust","rust-lang","scoop","script","skid","skids","skids-welcome","x86-64"],"created_at":"2025-07-07T07:15:59.876Z","updated_at":"2026-05-19T10:31:44.089Z","avatar_url":"https://github.com/benja2998.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# benja2998/batch\n\nBatch compiler written in [Rust](https://rust-lang.org)\n\n\u003e [!IMPORTANT]\n\u003e This compiler is incomplete. Consider contributing!\n\n## Usage\n\nInstall the compiler:\n\n```bash\nmake # .cargo/bin has to be in PATH\n# You can also run \"make install\", or \"cargo install --path .\" as they do the same thing\n```\n\nRun the compiler after installing:\n\n```bash\nmake run ARGS=\"-h\" # or \"batch-compiler -h\"\n```\n\nYou can also try some of the tests:\n\n```bash\nmake test\u003cnum\u003e # where \u003cnum\u003e is the test number. Currently, there are only 3 tests\n```\n\n## Limitations\n\n* If the batch file has no `exit` commands that are **always** executed, it may lead to undefined behavior in the compiled binary\n* Many batch features are not supported, such as `if` statements, `for` loops, delayed variable expansion, etc\n* Doing this:\n\n```batch\nset command=calc.exe\n%command%\n```\n\nwill only work if it is an external command, not a built-in command\n\n## Features\n\n* Compiled output is significantly faster than the Windows `cmd.exe` due to the executable using native Windows APIs and native CPU instructions\n\n## Benchmarking\n\nYou can benchmark the compiler by running `benchmark.bat`.\n\n## Currently supported batch features\n\n* Echo command\n* Exit command\n* Labels\n* Goto command\n* Comments (`rem` or `::`)\n* Set command\n* %VAR% variable syntax\n* Calling external commands\n\n## Supported OSes\n\n### Compiler itself\n\n* All OSes that support modern Cargo\n\n### Compiled batch files\n\n* All \"Modern\" versions of [Windows](https://windows.com) ([Windows Vista](https://en.wikipedia.org/wiki/Windows_Vista) and later, but only tested on [Windows 11](https://www.microsoft.com/en-gb/windows/get-windows-11))\n* [Linux](https://en.wikipedia.org/wiki/Linux) via [Wine](https://winehq.org) (no official support, untested)\n* [Android](https://android.com) via Termux \u0026 [Box64Droid](https://github.com/Ilya114/Box64Droid) (no official support, untested)\n* [macOS](https://apple.com/macos) via [Wine](https://winehq.org) (no official support, untested)\n\n## How it works\n\nThe compiler architecture goes like this:\n\n```mermaid\nflowchart TD\n  A[Batch file is provided as input] --\u003e B[Compiler reads and tokenizes the batch file]\n  B --\u003e C[Tokens]\n  C --\u003e D[Compiler grows the parse tree]\n  D --\u003e E[Parse tree]\n  E --\u003e F[Variables in the batch file are expanded]\n  F --\u003e G[Updated parse tree]\n  G --\u003e H[Compiler does two passes over the parse tree to generate assembly code]\n  H --\u003e I[Assembly code]\n  I --\u003e J[Compiler calls NASM to assemble the code]\n  J --\u003e K[Object file]\n  K --\u003e L[Compiler calls a linker to produce the executable]\n  L --\u003e M[Executable]\n```\n\n## License\n\nThe [Apache License 2.0](LICENSE).\n\n## FAQ\n\n**Q: How can I contact you privately?**\n\nA: You can contact me at [benja2998@duck.com](mailto:benja2998@duck.com). Responses won't be guaranteed as I don't look at it often.\n\n**Q: Will you add official Linux support?**\n\nA: Yes, but currently it is not a priority.\n\n**Q: Will you add official macOS support?**\n\nA: No.\n\n**Q: How can I contribute?**\n\nA: See [CONTRIBUTING.md](CONTRIBUTING.md).\n\n**Q: What is batch?**\n\nA: [Batch](https://en.wikipedia.org/wiki/Batch_file) is a [Windows](https://windows.com) scripting language developed by [Microsoft](https://microsoft.com). It is used in .cmd files, .bat files and the [Windows command prompt](https://en.wikipedia.org/wiki/Cmd.exe).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenja2998%2Fbatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenja2998%2Fbatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenja2998%2Fbatch/lists"}