mirror of
https://github.com/soconnor0919/tree-sitter-hack-assembly.git
synced 2026-10-14 01:55:40 +00:00
Tree-sitter grammar for Hack Assembly language (Nand2Tetris)
- C 79.6%
- C++ 11.6%
- Rust 3.8%
- JavaScript 2.3%
- Tree-sitter Query 2%
- Other 0.7%
- Added comprehensive README with usage instructions - Added .gitignore to prevent build artifacts from being committed - Removed target/ directories and duplicate WASM files - Cleaned up parser binaries and test files |
||
|---|---|---|
| bindings/rust | ||
| queries | ||
| src | ||
| .gitignore | ||
| binding.gyp | ||
| Cargo.lock | ||
| Cargo.toml | ||
| grammar.js | ||
| package.json | ||
| README.md | ||
| tree-sitter-hack_assembly.wasm | ||
| tree-sitter.json | ||
tree-sitter-hack-assembly
A Tree-sitter grammar for Hack Assembly language as used in the nand2tetris course.
Supported File Types
.asm- Hack Assembly source files
Features
- Syntax highlighting for A-instructions, C-instructions, and labels
- Code navigation with outline support for symbols and jumps
- Bracket matching for all syntax elements
- Integration with Zed editor and other Tree-sitter compatible editors
Usage
This grammar is designed to work with the nand2tetris-zed extension for Zed editor, providing complete language support for the nand2tetris course.
Grammar Details
- Language: Hack Assembly
- Scope:
source.hack_assembly - File Types:
.asm - Node Types:
a_instruction,c_instruction,label_declaration,symbol,constant
Development
Building
# Generate parser
tree-sitter generate
# Build parser
tree-sitter build
# Test grammar
tree-sitter test
Testing
# Run tests
tree-sitter test
# Parse a file
tree-sitter parse example.asm
License
MIT License - see LICENSE file for details.
Related
- nand2tetris-zed - Complete Zed extension
- nand2tetris.org - Course website
- Tree-sitter - Parser generator