minor changes for lex spec

This commit is contained in:
2025-11-04 13:43:56 +09:00
parent bbc1838b8a
commit 51773b4906
2 changed files with 13 additions and 2 deletions

View File

@@ -6,6 +6,8 @@
* RBRACK `]` * RBRACK `]`
* LCURLY `{` * LCURLY `{`
* RCURLY `}` * RCURLY `}`
* LPAREN `(`
* RPAREN `)`
* ID `[all]` * ID `[all]`
* SEMI `;` * SEMI `;`
* COMMA `,` * COMMA `,`
@@ -16,4 +18,13 @@
* RETURN `return` * RETURN `return`
* IF `if` * IF `if`
* ELSE `else` * ELSE `else`
* STRING `"{any}"` * STRING `"{any}"`
## Syntax Spec
```
decl := val typespec id stmt ;
typespec := id | [id* -> id?]
stmt :=
```

View File

@@ -1,6 +1,6 @@
val int s 3; # global val int s 3; # global
val [int->int] fib int n { val [int->int] fib (int n) {
return if == n 0 { return if == n 0 {
1 1
} else { } else {