aboutsummaryrefslogtreecommitdiff
path: root/include/interpreter.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/interpreter.h')
-rw-r--r--include/interpreter.h38
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