fix some specs and add for parse
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.vscode
|
||||||
16
README.md
16
README.md
@@ -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
0
include/parse.h
Normal file
4
src/parse.c
Normal file
4
src/parse.c
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#include "parse.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
Reference in New Issue
Block a user