diff options
| author | czjstmax <jstmaxlol@disroot.org> | 2025-12-21 21:24:46 +0100 |
|---|---|---|
| committer | czjstmax <jstmaxlol@disroot.org> | 2025-12-21 21:24:46 +0100 |
| commit | 9201d978d0c4d4f4bdffd4e686ef116d7fdaa982 (patch) | |
| tree | d78d98f3b157d39b2353165445b4a47569658da0 /src/headers/abstract.h | |
| parent | 05033cc80fc9839e402106ae60e92b69266d1595 (diff) | |
Fixed `#include` directives for `heads/` folder in `rbc.c`
Signed-off-by: czjstmax <jstmaxlol@disroot.org>
Diffstat (limited to 'src/headers/abstract.h')
| -rw-r--r-- | src/headers/abstract.h | 129 |
1 files changed, 0 insertions, 129 deletions
diff --git a/src/headers/abstract.h b/src/headers/abstract.h deleted file mode 100644 index efecaa0..0000000 --- a/src/headers/abstract.h +++ /dev/null @@ -1,129 +0,0 @@ -#ifndef CRBC_ABSTR -#define CRBC_ABSTR - -#include <stdlib.h> -#include <string.h> -#include <stdbool.h> - -// ===== EXPRESSIONS ===== -enum ExprKind { - EXPR_INT, EXPR_BOOL, - EXPR_CHAR, EXPR_STRING, - EXPR_IDENT -}; - -typedef struct Expr { - enum ExprKind kind; - void *as; -} Expr; - -typedef struct ExprInt { - int value; -} ExprInt; -// -typedef struct ExprChar { - char value; -} ExprChar; -// -typedef struct ExprBool { - bool value; -} ExprBool; -// -typedef struct ExprString { - char *value; -} ExprString; -// -typedef struct ExprIdent { - char *name; -} ExprIdent; - -// ===== STATEMENTS ===== -typedef struct Stmt { - int _dummy; -} Stmt; - -typedef struct Block { - int _dummy; -} Block; - -// ===== DECLARATIONS ===== -enum DeclKind { - DECL_VAR, - DECL_FUNC, - DECL_TYPE_STRUCT, - DECL_TYPE_ENUM, - DECL_TYPE_UNION -}; - -typedef struct Decl { - enum DeclKind kind; - void *as; -} Decl; - -// variable declaration -typedef struct DeclVar { - char *ident; - char *type; // TODO: replace with Type* - Expr *init; // NULL => declaration only -} DeclVar; - -// function declaration -typedef struct DeclFunc { - char *ident; - char *return_type; // NULL => inferred - char *params; // TODO: param list - Block *body; // NULL => forward declaration -} DeclFunc; - -// struct type declaration -typedef struct DeclTypeStruct { - char *ident; - char *members; // TODO: member list -} DeclTypeStruct; - -// enum type declaration -typedef struct EnumMember { - char *name; - char *value; // NULL => implicit -} EnumMember; - -typedef struct DeclTypeEnum { - char *ident; - EnumMember *members; -} DeclTypeEnum; - -// union type declaration -typedef struct DeclTypeUnion { - char *ident; - char *members; // TODO: member list -} DeclTypeUnion; - -// ===== FUNCTIONS ===== -static inline Decl *DeclareVariable(const char *ident, const char *type, Expr *init) { - Decl *decl = malloc(sizeof *decl); - DeclVar *var = malloc(sizeof *var); - - var->ident = strdup(ident); - var->type = type ? strdup(type) : NULL; - var->init = init; - - decl->kind = DECL_VAR; - decl->as = var; - - return decl; -} - -static inline Expr *ExprIntLiteral(int value) { - Expr *expr = malloc(sizeof *expr); - ExprInt *lit = malloc(sizeof *lit); - - lit->value = value; - - expr->kind = EXPR_INT; - expr->as = lit; - - return expr; -} - -#endif - |