fix some specs and add for parse

This commit is contained in:
2025-11-10 02:30:48 +09:00
parent 91f90419e1
commit 62b7024734
4 changed files with 15 additions and 8 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.vscode

View File

@@ -26,10 +26,13 @@
``` ```
program := defn* program := defn*
defn := VAL type ID ; defn := VAL type ID ;
| VAL type ID expr ; | VAL type ID expr ;
expr := atom atom* ; type := ID | [] | [type] | [ type* ARROW type? ]
expr := atom atom*
atom := ID atom := ID
| NUM | NUM
@@ -40,10 +43,9 @@ atom := ID
| dereference | dereference
stmt := defn stmt := defn
| expr | expr ; // expr statement
| return expr ; // return statement
| $ ID expr ; // assignment statement
stmt := defn | st | if expr compound ; // if statement
| if expr compound else compound ; // if-else statement
``` ```

0
include/parse.h Normal file
View File

4
src/parse.c Normal file
View File

@@ -0,0 +1,4 @@
#include "parse.h"
#include <stdlib.h>