New syntax that's easier to parse, parsing doesn't need variable lookup

This commit is contained in:
Krzosa Karol
2022-05-03 11:31:21 +02:00
parent 3c376bbe30
commit 8c04044ea2
12 changed files with 1216 additions and 244 deletions

16
expr.h
View File

@@ -1,5 +1,11 @@
#pragma once
typedef struct Expr Expr;
typedef struct Typespec Typespec;
typedef enum Expr_Sizeof_Kind{
SIZEOF_Expr,
SIZEOF_Type,
}Expr_Sizeof_Kind;
typedef enum Expr_Kind{
EK_None,
@@ -11,6 +17,7 @@ typedef enum Expr_Kind{
EK_List,
EK_Call,
EK_Index,
EK_Sizeof,
} Expr_Kind;
struct Expr {
@@ -19,7 +26,7 @@ struct Expr {
Expr *next;
union {
struct {
//Typespec *type;
Typespec *type;
Expr* expr;
} cast;
struct {
@@ -46,5 +53,12 @@ struct Expr {
Expr* on_true;
Expr* on_false;
} ternary;
struct{
Expr_Sizeof_Kind kind;
union{
Typespec *type;
Expr *expr;
};
} size_of;
};
};