diff options
author | dos-reis <gdr@axiomatics.org> | 2014-09-16 18:58:40 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2014-09-16 18:58:40 +0000 |
commit | 33259a6291be67fdc2545024f8fd5ff9603fd8dd (patch) | |
tree | fec669b435ffe2508ed89097b9948d1ec548cffd /src/include/Lisp.H | |
parent | 0401fe922d9155e62de78e37d2153986522e38e9 (diff) | |
download | open-axiom-33259a6291be67fdc2545024f8fd5ff9603fd8dd.tar.gz |
Add more functionalities to the VM.
Diffstat (limited to 'src/include/Lisp.H')
-rw-r--r-- | src/include/Lisp.H | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/include/Lisp.H b/src/include/Lisp.H index 724ab54b..119d07f8 100644 --- a/src/include/Lisp.H +++ b/src/include/Lisp.H @@ -47,21 +47,21 @@ namespace std { template<> - struct hash<OpenAxiom::VM::Scope> { + struct hash<OpenAxiom::VM::Package> { hash<OpenAxiom::VM::String>::result_type - operator()(const OpenAxiom::VM::Scope& s) const { - return h(s.name()); + operator()(const OpenAxiom::VM::Package& s) const { + return h(s.name); } hash<OpenAxiom::VM::String> h; }; template<> - struct equal_to<OpenAxiom::VM::Scope> { - using arg_type = OpenAxiom::VM::Scope; + struct equal_to<OpenAxiom::VM::Package> { + using arg_type = OpenAxiom::VM::Package; bool operator()(const arg_type& x, const arg_type& y) const { - return p(x.name(), y.name()); + constexpr equal_to<OpenAxiom::VM::String> eq { }; + return eq(x.name, y.name); } - equal_to<OpenAxiom::VM::String> p; }; } @@ -79,24 +79,20 @@ namespace OpenAxiom { explicit IntegerOverflow(const std::string&); }; - // -- Environments. - using Environment = std::map<Symbol*, Value>; - // -- Anchor maps using AnchorTable = std::map<Ordinal, Value>; // -- Evaluator -- struct Evaluator : VM::BasicContext { Evaluator(); - Scope* keyword_namespace() { return &keys; } - Scope* active_namespace() { return ns; } + Package* core_package() { return core; } + Package* current_package() { return ns; } Value toplevel_form(const Sexpr::Syntax*); Value make_value(const Sexpr::Syntax*); Environment* global_environment(); private: - Scope keys; - std::unordered_set<Scope> packages; - Scope* ns; + Package* core; + Package* ns; std::list<Environment> env_stack; AnchorTable anchor_map; }; |