better parser errors

This commit is contained in:
Masashi 2025-12-15 21:18:25 +05:30
commit f83a8e3ca1
13 changed files with 639 additions and 78 deletions

View file

@ -0,0 +1,24 @@
# Function syntax errors
# Missing function name
fn -> int
42
# Missing parameter type annotation
fn add(x, y: int) -> int
x + y
# Missing comma in parameters
fn add(x: int y: int) -> int
x + y
# Missing closing parenthesis
fn add(x: int, y: int -> int
x + y
# Missing return type arrow
fn add(x: int, y: int) int
x + y
# Invalid function body (missing expression)
fn test() -> int