feat: add ast and parser implementation

This commit is contained in:
2026-04-20 21:41:58 +02:00
parent 1006301255
commit 4981a78a8b
5 changed files with 881 additions and 9 deletions
+7 -9
View File
@@ -15,15 +15,13 @@ A Rust-flavored, C-targeting language - built pipeline-first.
## Phase 2 - Parser
- [ ] Write grammar for the base subset
- `fn` declarations, `return`, `let`, int/bool literals
- Arithmetic (`+`, `-`, `*`, `/`), comparison (`==`, `!=`, `<`, `>`)
- Function call expressions
- [ ] Implement recursive-descent parser
- [ ] Build typed AST: `FnDecl`, `Block`, `ReturnStmt`, `LetStmt`, `BinExpr`, `CallExpr`, `Literal`, `Ident`
- [ ] Attach source spans to every AST node
- [ ] Emit structured parse errors with span info
- [ ] Unit-test: parse valid snippets, expect correct AST shapes
- [x] Write grammar for the base subset
- `fn` declarations, `return`, int/bool literals
- Arithmetic (`+`, `-`, `*`, `/`)
- [x] Implement recursive-descent parser
- [x] Attach source spans to every AST node
- [x] Emit structured parse errors with span info
- [x] Unit-test: parse valid snippets, expect correct AST shapes
## Phase 3 - Semantic Analysis