{"id":31825738,"url":"https://github.com/chrischtel/rask","last_synced_at":"2026-05-14T12:32:08.010Z","repository":{"id":318356081,"uuid":"1070928136","full_name":"chrischtel/rask","owner":"chrischtel","description":"A modular, low-level code generation toolkit for Rust.","archived":false,"fork":false,"pushed_at":"2025-10-08T07:55:42.000Z","size":47,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-22T11:12:42.795Z","etag":null,"topics":["assembler","code-generation","instruction-encoding","jit-compiler","rust","x86-64"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrischtel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2025-10-06T16:15:59.000Z","updated_at":"2025-12-12T05:57:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"290a4524-a2b0-4948-9bf2-7dc1a0237959","html_url":"https://github.com/chrischtel/rask","commit_stats":null,"previous_names":["chrischtel/rask"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/chrischtel/rask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Frask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Frask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Frask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Frask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrischtel","download_url":"https://codeload.github.com/chrischtel/rask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrischtel%2Frask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33024929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-14T02:00:06.663Z","response_time":57,"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":["assembler","code-generation","instruction-encoding","jit-compiler","rust","x86-64"],"created_at":"2025-10-11T16:23:42.481Z","updated_at":"2026-05-14T12:32:08.005Z","avatar_url":"https://github.com/chrischtel.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rask - x86_64 Instruction Encoder \u0026 Code Generation Toolkit\r\n\r\n**An experimental x86_64 instruction encoding library for Rust. Early development - expect breaking changes.**\r\n\r\nRask is a learning-focused x86_64 instruction encoder that lets you generate machine code programmatically. If you want to experiment with low-level code generation, learn x86_64 encoding, or prototype JIT ideas - Rask gives you a clean foundation to build on.\r\n\r\n⚠️ **Early Development Warning**: Rask is still very early — the API will change, many instructions are missing, and it’s not ready for production.  \r\nBut it’s already a great playground if you want to learn how x86_64 encoding actually works.\r\n\r\n## Why Rask?\r\n\r\n**Educational First** - Every instruction is documented with Intel SDM references. You'll actually understand what's happening.\r\n\r\n**Lightweight \u0026 Hackable** - When LLVM is overkill and you want to understand the basics, Rask is small enough to read and modify.\r\n\r\n**Type-Safe Foundation** - Catch encoding errors at compile time instead of debugging invalid machine code.\r\n\r\n**Correct Encoding** - What's implemented generates byte-perfect machine code with comprehensive tests.\r\n\r\n## Quick Start\r\n\r\nAdd Rask to your project:\r\n\r\n```toml\r\n[dependencies]\r\nrask-x86_64 = \"0.1.0\"\r\nrask-common = \"0.1.0\"\r\n```\r\n\r\nGenerate your first machine code:\r\n\r\n```rust\r\nuse rask_x86_64::{encoder::Encoder, registers::Reg64::*, operand::Operand};\r\n\r\nlet mut encoder = Encoder::new();\r\n\r\n// mov rax, 1337\r\nencoder.mov(Operand::Reg(RAX), Operand::Imm(1337));\r\n\r\n// add rax, rbx  \r\nencoder.add(RAX, RBX);\r\n\r\n// ret\r\nencoder.ret();\r\n\r\nlet machine_code = encoder.bytes();\r\n// Output: [0x48, 0xb8, 0x39, 0x05, ...]\r\n```\r\n\r\n## Supported Instructions\r\n\r\n**Memory Operations**\r\n- `mov reg, [mem]` - Load from memory\r\n- `mov [mem], reg` - Store to memory  \r\n- `mov reg, reg` - Register to register\r\n- `mov reg, immediate` - Load immediate values\r\n\r\n**Arithmetic**\r\n- `add reg, reg` - 64-bit addition\r\n- `sub reg, reg` - 64-bit subtraction\r\n\r\n**Control Flow**\r\n- `ret` - Function return\r\n\r\n**Coming Soon:** Jump instructions, more arithmetic, stack operations, function calls\r\n\r\n## Advanced Features\r\n\r\n**Memory Addressing with Displacement**\r\n```rust\r\nuse rask_x86_64::operand::MemOperand;\r\n\r\n// mov rax, [rbx + 8]\r\nlet mem = MemOperand { base: RBX, disp: 8 };\r\nencoder.mov(Operand::Reg(RAX), Operand::Mem(mem));\r\n```\r\n\r\n**Extended Register Support (R8-R15)**\r\n```rust\r\n// Automatic REX prefix handling\r\nencoder.mov(Operand::Reg(R10), Operand::Imm(42));\r\nencoder.add(R8, R9);\r\n```\r\n\r\n**Cross-Platform Target Support**\r\n```rust\r\nuse rask_common::{Target, Architecture, Abi};\r\n\r\nlet target = Target::from_arch(Architecture::X86_64, Abi::SystemV);\r\n// Use target info for platform-specific code generation\r\n```\r\n\r\n## Examples\r\n\r\nRun the included examples to see Rask in action:\r\n\r\n```bash\r\n# Basic instruction encoding\r\ncargo run --example basic_encoding\r\n\r\n# REX prefix demonstration  \r\ncargo run --example rex_prefixes\r\n\r\n# Arithmetic operations\r\ncargo run --example arithmetic\r\n```\r\n\r\n## Use Cases\r\n\r\n**JIT Compilers** - Generate machine code at runtime for dynamic languages or DSLs\r\n\r\n**Assembly Tools** - Build custom assemblers or code analysis tools\r\n\r\n**Compiler Backends** - Use as a backend for your programming language\r\n\r\n**Educational Projects** - Learn x86_64 instruction encoding with clear, documented examples\r\n\r\n**Performance Critical Code** - Generate optimized machine code for specific algorithms\r\n\r\n## Architecture\r\n\r\nRask is built as a modular workspace:\r\n\r\n- **`rask-common`** - Shared types, target definitions, utilities\r\n- **`rask-x86_64`** - x86_64 instruction encoding\r\n- **`rask-aarch64`** - ARM64 support (planned)\r\n\r\n#### _*more crates are coming in the future*_\r\n\r\n## Documentation\r\n\r\nEach instruction encoder includes comprehensive documentation with:\r\n- Intel SDM references\r\n- Encoding format details\r\n- Example byte sequences\r\n- ModR/M and REX prefix explanations\r\n\r\n## Testing\r\n\r\nRask includes extensive test coverage with byte-level verification:\r\n\r\n```bash\r\ncargo test\r\n```\r\n\r\nEvery instruction is tested against known-good byte sequences to ensure correctness.\r\n\r\n## Contributing\r\n\r\nRask is designed to be hackable and extensible. Adding new instructions is straightforward:\r\n\r\n1. Implement the encoding logic\r\n2. Add comprehensive tests  \r\n3. Document with Intel SDM references\r\n4. Submit a pull request\r\n\r\nSee our examples for instruction implementation patterns.\r\n\r\n## Roadmap\r\n\r\n**Current:** x86_64 core instructions, memory operations\r\n**Next:** Jump instructions, function calls, stack operations  \r\n**Future:** ARM64 support, high-level code generation, optimization passes\r\n\r\n## License\r\n\r\nLicensed under either of\r\n\r\n* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\r\n* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\r\n\r\nat your option.\r\n\r\n### Contribution\r\n\r\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrischtel%2Frask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrischtel%2Frask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrischtel%2Frask/lists"}