fix(parser): infinite loop on newlines in multi-import, multi-line params, type args, struct patterns
Parser would hang (infinite loop) when encountering newline tokens inside certain constructs because expect() returns without advancing position when the expected token doesn't match. Fixed 5 places in parseBaseType, parsePrimaryPattern, parseTypeParams, parseParamList, and parseUseDecl by adding newline-skipping at the start of each iteration. Verified: compiler no longer hangs/crashes on all 3 real-world apps from apps/ (boko-framework, jwt-pitbul, nexus).
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
> **Selfhost loop:** `buxc2` can compile itself — deterministic C codegen verified.
|
||||
> **LIR backend** produces clean 3-address C code. All 26 examples pass.
|
||||
> **Gradual Ownership:** `@[Checked]` borrow checker, `borrow &mut` expressions, `@[Shared]` attribute.
|
||||
> **Apps tested:** compiler successfully parses all 3 real-world apps (`apps/boko-framework`, `apps/jwt-pitbul`, `apps/nexus`) — no hangs, no crashes.
|
||||
|
||||
Bux is a fast, compiled, strongly-typed systems programming language. Features a C backend for native code generation, raw multi-line strings, gradual ownership (opt-in borrow checking), async/await, generics, algebraic enums, and a package manager.
|
||||
|
||||
@@ -254,6 +255,20 @@ make clean
|
||||
|
||||
---
|
||||
|
||||
## Applications
|
||||
|
||||
The `apps/` directory contains real-world Bux applications that serve as integration tests for the compiler:
|
||||
|
||||
| App | Description | Lines |
|
||||
|-----|-------------|-------|
|
||||
| **boko-framework** | Async web framework (like FastAPI), multi-threaded HTTP server | ~660 |
|
||||
| **jwt-pitbul** | JWT CLI tool — sign, verify, decode (HS256/384/512, RS256/384/512, ES256/384, EdDSA) | ~326 |
|
||||
| **nexus** | High-performance HTTP/1.1, HTTP/2 & WebSocket server | ~550 |
|
||||
|
||||
The bootstrap compiler successfully parses and type-checks all three applications without hanging or crashing.
|
||||
|
||||
---
|
||||
|
||||
## Documentation
|
||||
|
||||
- [`docs/LanguageRef.md`](docs/LanguageRef.md) — Language reference
|
||||
|
||||
Reference in New Issue
Block a user