Refactor stack to now use ints instead of long ints
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dominic Grimm 2023-08-06 11:20:14 +02:00
parent 7490439223
commit 03a9b46e33
7 changed files with 62 additions and 24 deletions

View file

@ -27,7 +27,7 @@ struct hf__interpreter {
struct hf__hashmap words; // struct hf__interpreter__word *
long *stack;
int *stack;
size_t stack_len;
size_t stack_size;
@ -43,8 +43,8 @@ typedef struct hf__result (*hf__interpreter__word_func_t)(
extern const hf__interpreter__word_func_t
HF__INTERPRETER__WORD_FUNCTION[__HF__NODE_TYPE__N];
extern void hf__interpreter__stack_push(long **arr, size_t *const len,
size_t *const cap, long item);
extern void hf__interpreter__stack_push(int **arr, size_t *const len,
size_t *const cap, int item);
extern struct hf__result
hf__interpreter__run(struct hf__interpreter *const interpreter);

View file

@ -9,6 +9,8 @@ enum hf__token_type {
HF__TOKEN_TYPE__CHAR,
HF__TOKEN_TYPE__WORD,
HF__TOKEN_TYPE__PERIOD_STRING,
HF__TOKEN_TYPE__COLON,
HF__TOKEN_TYPE__SEMICOLON,

View file

@ -50,7 +50,7 @@ struct hf__node_value__word_def {
};
union hf__node_value {
long number;
int number;
char ch;
struct hf__node_value__word word;
struct hf__node_value__word_def *word_def;