Created Interpreter Interface
This commit is contained in:
parent
95dba7e478
commit
390fc1981d
|
|
@ -57,4 +57,8 @@ typedef struct {
|
||||||
HashTable functions;
|
HashTable functions;
|
||||||
} InterpreterState;
|
} InterpreterState;
|
||||||
|
|
||||||
|
InterpreterState *interpreter_create();
|
||||||
|
void execute(InterpreterState *interpreter, LexerTokenResult *token);
|
||||||
|
void interpreter_delete(InterpreterState *interpreter);
|
||||||
|
|
||||||
#endif // SLS_INTERPRETER_H
|
#endif // SLS_INTERPRETER_H
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,9 @@
|
||||||
// Interpreter
|
// Interpreter
|
||||||
// November 2025
|
// November 2025
|
||||||
|
|
||||||
|
#include "sls/string.h"
|
||||||
#include "sls/interpreter.h"
|
#include "sls/interpreter.h"
|
||||||
|
#include "sls/lexer.h"
|
||||||
|
|
||||||
const char *STACK_TYPES_NAMES[] = {
|
const char *STACK_TYPES_NAMES[] = {
|
||||||
"Identifier",
|
"Identifier",
|
||||||
|
|
@ -23,3 +25,11 @@ const char *STACK_TYPES_NAMES[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
const size_t STACK_TYPE_COUNT = sizeof(STACK_TYPES_NAMES) / sizeof(*STACK_TYPES_NAMES);
|
const size_t STACK_TYPE_COUNT = sizeof(STACK_TYPES_NAMES) / sizeof(*STACK_TYPES_NAMES);
|
||||||
|
|
||||||
|
static Boolean hash_table_put_funcs(HashTable *ht, SlsStr key, TokenString *item) {
|
||||||
|
return hash_table_put(ht, key, (void *)item);
|
||||||
|
}
|
||||||
|
|
||||||
|
static TokenString* hash_table_get_funcs(const HashTable *ht, SlsStr key, TokenString *default_item) {
|
||||||
|
return (TokenString*)hash_table_get(ht, key, (void *)default_item);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue