replace uses of AssocList with Dictionary (#344)

Co-authored-by: Geoff Romer <gromer@google.com>
Co-authored-by: Dave Abrahams <dabrahams@google.com>
This commit is contained in:
Jeremy G. Siek
2021-03-06 08:06:05 -08:00
committed by GitHub
co-authored by Geoff Romer Dave Abrahams
parent 5d6593ee39
commit 05db2012ab
9 changed files with 185 additions and 172 deletions
@@ -11,19 +11,19 @@
#include "executable_semantics/ast/declaration.h"
#include "executable_semantics/interpreter/action.h"
#include "executable_semantics/interpreter/assoc_list.h"
#include "executable_semantics/interpreter/dictionary.h"
#include "executable_semantics/interpreter/stack.h"
#include "executable_semantics/interpreter/value.h"
namespace Carbon {
using Env = AssocList<std::string, Address>;
using Env = Dictionary<std::string, Address>;
/***** Scopes *****/
struct Scope {
Scope(Env* e, std::list<std::string> l) : env(e), locals(std::move(l)) {}
Env* env;
Scope(Env e, std::list<std::string> l) : env(e), locals(std::move(l)) {}
Env env;
std::list<std::string> locals;
};
@@ -45,7 +45,7 @@ struct State {
extern State* state;
void PrintEnv(Env* env);
void PrintEnv(Env env);
auto AllocateValue(Value* v) -> Address;
auto CopyVal(Value* val, int line_num) -> Value*;
auto ToInteger(Value* v) -> int;
@@ -53,7 +53,7 @@ auto ToInteger(Value* v) -> int;
/***** Interpreters *****/
auto InterpProgram(std::list<Declaration>* fs) -> int;
auto InterpExp(Env* env, Expression* e) -> Value*;
auto InterpExp(Env env, Expression* e) -> Value*;
} // namespace Carbon