From d8f5ad44b584fb23e6d0cab7161d7adf09dcc606 Mon Sep 17 00:00:00 2001 From: Kyler Date: Fri, 28 Nov 2025 14:58:15 -0700 Subject: [PATCH] Added linked-list based stack --- SLS_C/include/sls/interpreter.h | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/SLS_C/include/sls/interpreter.h b/SLS_C/include/sls/interpreter.h index 8a8b3d6..a07a79a 100644 --- a/SLS_C/include/sls/interpreter.h +++ b/SLS_C/include/sls/interpreter.h @@ -8,6 +8,8 @@ #include +#include "sls/lexer.h" + typedef enum { STACK_IDENTIFIER, STACK_I64, @@ -23,9 +25,35 @@ typedef enum { STACK_CHARACTER, STACK_BOOLEAN, STACK_TOKEN_STRING, -} StackTypes; +} StackType; extern const char *STACK_TYPES_NAMES[]; extern const size_t STACK_TYPE_COUNT; +typedef struct StackItem { + StackType type; + union { + Identifier identifier; + int64_t i64; + int32_t i32; + int16_t i16; + int8_t i8; + uint64_t u64; + uint32_t u32; + uint16_t u16; + uint8_t u8; + float f32; + double f64; + char character; + Boolean boolean; + TokenString token_string; + }; + StackItem *next; +} StackItem; + +typedef struct { + StackItem *stack; + +} InterpreterState; + #endif // SLS_INTERPRETER_H