From 98826534a13d5402b90bdc050e30313219995a82 Mon Sep 17 00:00:00 2001 From: Speedy_Lex Date: Tue, 5 May 2026 21:45:58 +0200 Subject: [PATCH] Add very important stuff that compiles!!! --- src/compiler.h | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/noom.h | 2 ++ src/types.h | 4 +++ 3 files changed, 99 insertions(+) diff --git a/src/compiler.h b/src/compiler.h index dda1b5b..a88d559 100644 --- a/src/compiler.h +++ b/src/compiler.h @@ -3,6 +3,9 @@ typedef enum noomC_InstrType : unsigned char { NOOMC_INSTR_NOP = 0, NOOMC_INSTR_LOADC, + NOOMC_INSTR_LOAD_NIL, + NOOMC_INSTR_LOAD_TRUE, + NOOMC_INSTR_LOAD_FALSE, NOOMC_INSTR_COPY, NOOMC_INSTR_JMP, @@ -37,7 +40,11 @@ typedef enum noomC_InstrType : unsigned char { NOOMC_INSTR_CONCAT, NOOMC_INSTR_LEN, NOOMC_INSTR_GET, + NOOMC_INSTR_GETI, NOOMC_INSTR_SET, + NOOMC_INSTR_SETI, + + NOOMC_INSTR_LOAD_NFT, NOOMC_INSTR_NOP2 = 0xff, } noomC_InstrType; @@ -54,3 +61,89 @@ typedef struct noomC_Instr { short s; }; } noomC_Instr; + +typedef enum noomC_ImmType { + NOOMC_IMM_INT, + NOOMC_IMM_FLOAT, + NOOMC_IMM_STRING, + NOOMC_IMM_TABLE, +} noomC_ImmType; + +typedef struct noomC_Imm { + noomC_ImmType type; + union { + // we love math + noom_int_t Z; + noom_float_t Q; +// NOT A MATH THING + noom_string_t string; + noom_table_t table; +// ░░░░░░░░░ ░ ▒░░▒ ▒░ ░░ ░ +// ░░░░░░░░░ █░█░▓▓ ░█▒████▒░ █░░████▓ +// ░░░░░░░░░ ▓████████░█░▒████▓░████ ░█░ +// ░░░░░░░░░ ░░░ ░█▓░█▒█░█░▒▒█▓████▒ ░█▒█ ░█░░ +// ░░░░░░░░░ ░░░░░ ░█▓▓███▒█ ▓▓▒▒▒▓▓▒ ▒█▒█▓██▓▓ +// ░░░░░░░░░ ░░ ░▓▓███▓█▒░░█▒▓█▓██▓ ▒▓█▓▓▓█▒▒ +// ░░░░░░░░░░ ░░ ▒▓█░█▒█░ ░▓▓██████░░██░░▒█ +// ░░░░░░░░░░ ░░░░ ░░ ▓▓█▒█▓█▒░ ▒▒▒█▒░█░ ███░░█ +// ░░░░░░░░░░ ░░ ▓▒▓███░█▒ ▒░░░▓▓█░░██░▓▒██ +// ░░░░░░░░░░ ░░ ░ ░░ ░░ ░░ ░░ ▒░ ░░░ ░░ +// ░░░░░░░░░░ ░ ░░░ ░ ░ ░ ░ +// ░░░░░░░░░░ ░░░░ ░░ ░ +// ░ ░░░░░░░░░ ░░░░ ░ ░ ░ ░░ ░░░ ░░░ ░ ░░ +// ░░░░░░░░░ ░ █████ ▒████ ░▓███▓░ ░████░ ░████▓ ░████░ ░▓███▓ ░████░ +//░░ ░░░░░░░░░ █▓▒██░░██▓██▒░░██▒██░░██▒▓██░▒██▒██ ██▓▓██ ░██▒██░ ██▒▓██ +//░░ ░░░░░░░░░░ ██░▒█▓ ░██░██▒ ▒█▒░██ ░██ ██░ ▓█▒░██ ░██░██░ ▓█▒░██ ██░ +// ░░░░░░░░░░░ ░▓███░▒█▓ ██░██░ ▒██▒██ ░██░██ ▒█▒░██ ░██░██░ ▒█▓▒█▓ ░██░ +// ░░░░░░░░░░ ░ ░▒███░ ▓████░▓█▒ ░██░██░ ▒██▒█▓ ░██░██ ░▒█▒░██ ░██░██░ ░██▒█▓ ░██░░ +// ░░░░░░░░░ ░░ ░ ░░██▓▓█▓░░██ ██░ ▒█▓▒█▓ ██░██░ ▒█▒░██ ░██░██░ ░██▒█▓ ░██░░ +// ░░░░░░░░░░ ░░░░ ░ ░███▒██ ░██ ██▒ ▓█▒▒██ ░██░██░ ██░░██░░██ ██▒ ▓█░░██ ░██ +// ░░░░░░░░░ ░░░ ░█████▒░█████▒▒▓█████ ░█████▒ ▒█████▓██████▓ ▒██▓██░ █████▒ +// ░░░░░░░░░ ░░ ░████▒ ░░███▒░█▒▒███░ ░███▓ ▓███░▓█░███▓░ ▒███░ ░███▒ +// ░░░░░░░░░░ ░█░ ░ ░ ▒▒ ░ +// ░░░░░░░░░ ░ ░ +// ░░░░░░░░░ ░░░░ +// ░░░░░░░░░ ░░░░░ ░░ ░ ░ ░ ░ +// ░░░░░░░░░ ░░ ░░▒░░ ░▓▒ ░█▓ ░ ░ ░ +// ░░░░░░░░░ ░░ ▒█████░ ░██ ░██ ░ ░ +// ░░░░░░░░░░░░░ ██▒▒███ ░░ ░ ░ ░░ ░░ ░██ +// ░ ░░░░░░░░░░░░░░░ ██░ ░▓▓ ░████ ░████░░█▓ ▒███▓░░██ +// ░░░░░░░░░░░░░░░░░░░░░▓███░░ ░██████░██▓██▓▒██░██▓██▒▒██░ +// ░░░░░░░░░░░░░░░░░░░░ ░████░░█▓ ██░██ ▓▓░██ ░░▒██▓▒██░ ░ +// ░░░░░░░░░░░░░░░░░░░ ░░░░███▒█▓ ██▒██ ░░██░█████▓▒██░ ░░ ░ +// ░░░░░░░░░░░░░░░░░░ ░██▒ ░██▒██░░██░██ ░█▓░██░██░▓█▓░██░ ░ ██▓████████▓▒██▒ +// ░░░░░░░░░░░░░░░░░ ░██████▓ █████▓ █████▓▒██░█████▓░██░ ░ ░░░███████████▓█▓ +// ░░░░░░░░░░░░░░░░░░ ░▓███▒ ░███▒ ░▓██▓ ░█▓ ▒██▓█▓░██░ ░████████████▓█░ +// ░░░░░░░░░░░░░░░░░ ░ ░ ░█████████▓██ +// ░░░░░░░░░░░░░░ ░░ ▒███████▓█▓ +// ░ ░░░░░░░░░░░░░░ ░░░░ ██▓██▓▓▓███ ░ +// ░░░░░░░░░░░░░░░ ░░ ░ ░███████████ +// ░░░░░░░░░░░░ ░░ ░ ████████████ ▒ +// ░░░░░░░░░░░░ ░░▒▒░░ ░ ░██░▓█░ ░ ░░████ ▒██████ █ +// ░░░░░░░░░░░ ▓█████░ ░██ ██░░█▓░ ▓████ ▓█████ ░█ ▒▒ +// ░░░░░░░░░░░ ▒██░░██▒░░░░░ ░░░░░ ░░░░██ ░░░██░ █████ ▒█████ ▒█ ▒█░ +// ░░░░░░░░░░░░░ ██▒ ░█▓░████░████░ ░█████ ██▒████ █████ ▓████▒ ████░ +// ░░░░░░░░░░░░ ██░ ▒███▓██▓▓██ ██▒▒██ ██░▒██░ ████▒ █████ ▒████████ +// ░░░░░░░░░░ ██░ ░ ▒██░ ██▒▒██░██ ░██ ██ ░██░ ░████ ░█████ ▓██▓▒░░ +// ░░░░░░░░░░ ██▒ ░▒░▒██ ░██████▒██ ░██░██░░██ ▒███▒ █████▒ +// ░ ░░░░░░░░░ ▓█▓░ ▓█▓▒██ ░██░ ░░░██ ░██ ██░░██░ ░███░░░█████ +// ░░░░░░░░░ ██████ ▒█▓ ▓█████ ██████ ██░░███░ ░██▒ █████▒ +// ░░░░░░░░░ ░▓███░░░█▓ ░░▒███░░░██▓█▓ ▓█░ ▒█▓░ ▓▓ ░█████ +// ░░░░░░░░░ ░░░░ ░░ ░░ ░ ░ ▓▒ ▓████░ +// ░░░░░░░░ ░░ ░░ ░ ▒▓ ████▒ +// ░ ░░░░░ ░ ░ ▒░▓███▒ +// ░░░░ ░ ░▓▓██ +// ░░░ +// ░░░ +// ░░ + }; +} noomC_Imm; + +typedef struct noomC_Function { + noomC_Imm *immediates; + noomC_Instr *instructions; +} noomC_Function; + +typedef struct noomC_Module { + noomC_Function *functions; +} noomC_Module; diff --git a/src/noom.h b/src/noom.h index 864f978..3958ea8 100644 --- a/src/noom.h +++ b/src/noom.h @@ -1,3 +1,5 @@ +#define NOOM_USE_NFT 0 + typedef enum noom_LuaVersion { // no 5.0, at least for now, cause it doesn't seem to be used much and is a bit *weird* NOOM_VERSION_51, diff --git a/src/types.h b/src/types.h index 2ed5b1b..2033139 100644 --- a/src/types.h +++ b/src/types.h @@ -1,2 +1,6 @@ typedef unsigned long long int noom_uint_t; typedef signed long long int noom_int_t; +typedef double noom_float_t; +typedef unsigned char noom_bool_t; +typedef void * noom_table_t; // atom figure this shit out +typedef char * noom_string_t;