diff options
author | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2025-05-25 15:54:50 +0200 |
---|---|---|
committer | Flavian Kaufmann <flavian@flaviankaufmann.ch> | 2025-05-25 15:54:50 +0200 |
commit | 330e46236b421ffb8fe263caf91196f4cd1114c5 (patch) | |
tree | 09b3df77fca2d23dacef64f6962e9a1afd5b4d29 /include/interpreter.h | |
parent | de59dbd1773dff06051b7b604977bcb2803ada4f (diff) | |
download | imp-330e46236b421ffb8fe263caf91196f4cd1114c5.tar.gz imp-330e46236b421ffb8fe263caf91196f4cd1114c5.zip |
[cleanup] codebase cleanup
Diffstat (limited to 'include/interpreter.h')
-rw-r--r-- | include/interpreter.h | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/include/interpreter.h b/include/interpreter.h index 5eff23f..d5a1e7a 100644 --- a/include/interpreter.h +++ b/include/interpreter.h @@ -1,26 +1,30 @@ -#ifndef INTERPRETER_H -#define INTERPRETER_H +#ifndef IMP_INTERPRETER_H +#define IMP_INTERPRETER_H -#include "ast.h" - +/** + * @file interpreter.h + * @brief Interpreter for evaluating IMP language programs. + * + * @author Flavian Kaufmann + */ -typedef struct Context *context_t; +#include "ast.h" +#include "interpreter_context.h" -context_t context_create(void); -void context_free(context_t context); - -int context_get_var(context_t context, const char *name); -void context_set_var(context_t context, const char *name, int value); -void context_print_var_table(context_t context); -void context_print_proc_table(context_t context); -int interp_ast(context_t context, IMP_ASTNode *node); -int interp_file (context_t context, const char *path); -int interp_str (context_t context, const char *str); +/** + * Evaluates an AST node within a given context. + * + * @param context The interpreter context. + * @param node AST node to evaluate. + * @return Status code or result of evaluation. (0 for success, non-zero for error). + * + * @note The interpreter does neither take ownership of the context nor the AST node. + */ +int imp_interpreter_interpret_ast(IMP_InterpreterContext *context, const IMP_ASTNode *node); -int print_ast_file (const char *path); -#endif
\ No newline at end of file +#endif /* IMP_INTERPRETER_H */
\ No newline at end of file |