-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJMachine.hpp
More file actions
41 lines (35 loc) · 956 Bytes
/
JMachine.hpp
File metadata and controls
41 lines (35 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef JMACHINE_HPP
#define JMACHINE_HPP
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
#include <map>
#include <string>
#include <utility>
#include <vector>
#include <algorithm>
#include <functional>
#include "JGrammar.hpp"
#include "Locale.hpp"
namespace J {
using boost::shared_ptr;
using std::map;
using std::string;
using std::pair;
using std::vector;
using boost::optional;
class JMachine {
typedef map<string, JWord::Ptr>::const_iterator map_iterator;
map<string, JWord::Ptr> operators;
shared_ptr<Locale> cur_locale;
JMachine();
public:
typedef shared_ptr<JMachine> Ptr;
static Ptr new_machine();
optional<JWord::Ptr> lookup_symbol(const string& sym) const;
shared_ptr<vector<string> > list_symbols() const;
optional<JWord::Ptr> lookup_name(const string&) const;
void add_public_symbol(const string& name, JWord::Ptr word);
void add_private_symbol(const string& name, JWord::Ptr word);
};
}
#endif