]> git.lizzy.rs Git - nothing.git/blob - src/script/interpreter.h
(#311) implement eval
[nothing.git] / src / script / interpreter.h
1 #ifndef INTERPRETER_H_
2 #define INTERPRETER_H_
3
4 #include <stdbool.h>
5 #include "expr.h"
6
7 struct EvalResult
8 {
9     bool is_error;
10     union
11     {
12         struct Expr expr;
13         const char *error;
14     };
15 };
16
17 struct EvalResult eval_success(struct Expr result);
18 struct EvalResult eval_failure(const char *error);
19
20 struct EvalResult eval(struct Expr scope, struct Expr expr);
21
22 #endif  // INTERPRETER_H_