Parsing exprs, enum_decls, Introduce intern table, symbol table

This commit is contained in:
Krzosa Karol
2022-04-29 11:22:10 +02:00
parent d462892e14
commit 9cbbb4d616
20 changed files with 1831 additions and 335 deletions

51
lang.h Normal file
View File

@@ -0,0 +1,51 @@
#pragma once
#define global static
#define function static
#define assert(x) do{if(!(x)) __debugbreak();}while(0)
#define assert_msg(x,msg) assert(x)
#define not_implemented assert_msg(0, "Not implemented")
#define invalid_codepath assert_msg(0, "Invalid codepath")
#define buff_cap(x) (sizeof(x)/sizeof((x)[0]))
#define lit(x) ((String){(U8*)x,buff_cap(x)-1})
#define meta(x)
#include <stdint.h>
typedef int8_t S8;
typedef int16_t S16;
typedef int32_t S32;
typedef int64_t S64;
typedef uint8_t U8;
typedef uint16_t U16;
typedef uint32_t U32;
typedef uint64_t U64;
typedef S8 B8;
typedef S16 B16;
typedef S32 B32;
typedef S64 B64;
typedef uint64_t SizeU;
typedef int64_t SizeI;
typedef float F32;
typedef double F64;
const B32 true = 1;
const B32 false = 0;
#define kib(x) ((x)*1024llu)
#define mib(x) (kib(x)*1024llu)
#define gib(x) (mib(x)*1024llu)
typedef struct String{
U8 *str;
S64 len;
}String;
#define SLLQueuePush(f,l,n) do{\
if((f)==0){\
(f)=(l)=(n);\
}\
else{\
(l)=(l)->next=(n);\
} \
}while(0)