Parse async functions and await expressions
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
Parent: #439
## Summary
Add source-level `async` and `await` syntax without performing coroutine lowering.
## Scope
- Reserve `async` and `await` in the lexer with stable token names and spans.
- Parse `async fun name(...) -> T { ... }` wherever an ordinary function declaration is valid.
- Parse prefix `await expression` with documented precedence.
- Preserve async declarations and await expressions in the source AST.
- Support visibility parsing as `pub async fun`; continue rejecting every public `main` declaration.
- Produce focused diagnostics for missing `fun`, missing await operand, invalid declaration order, and malformed bodies.
- Keep `extern` and `export` async forms syntactically representable only if needed for a precise semantic rejection; do not silently accept them as synchronous functions.
## Completion criteria
- [ ] Lexer and parser unit tests cover valid nested expressions and malformed syntax.
- [ ] AST debug output exposes async declarations and await nodes.
- [ ] Existing identifiers and declaration parsing regressions remain green apart from the intentional keyword reservation.
- [ ] Parser changes do not add LLVM or runtime dependencies.
Semantic legality and types are handled separately from this issue.
Contributor guide
Research direction
Start by locating the lexer, parser, existing function-declaration and expression parsing, and AST debug output; read the related unit tests first. Done means async and await syntax is preserved in the AST, focused malformed-syntax diagnostics are covered, and existing declaration and identifier tests remain green without LLVM or runtime changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100