Add argument variable binding
diff --git a/src/lisp/compiler.h b/src/lisp/compiler.h
index ae66001..4d8ffba 100644
--- a/src/lisp/compiler.h
+++ b/src/lisp/compiler.h
@@ -27,10 +27,19 @@
struct function *first;
};
+enum var_type
+{
+ V_BOUND, // Bound local variable
+ V_ARGUMENT, // Bound function argument
+ V_GLOBAL, // Global variable
+ V_FREE // Free (lexical) variable
+};
+
struct variable
{
char *name;
- int number;
+ uintptr_t number;
+ enum var_type type;
struct variable *prev;
};
@@ -52,3 +61,8 @@
void compile_tl(value_t val, struct environment *env);
struct environment compile_all(struct istream *is);
struct function *find_function(struct environment *env, char *name);
+struct variable *add_variable(struct local *local, enum var_type type,
+ char *name, int number);
+// Might return null
+struct variable *find_variable(struct local *local, char *name);
+void destroy_local(struct local *local);