-
Notifications
You must be signed in to change notification settings - Fork 0
/
Interpreter.h
63 lines (50 loc) · 1.33 KB
/
Interpreter.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//
// Interpreter.h
// Project3
//
// Created by Michael Bird on 7/21/14.
// Copyright (c) 2014 Michael Bird. All rights reserved.
//
#ifndef __Project3__Interpreter__
#define __Project3__Interpreter__
#include <iostream>
#include <sstream>
#include <set>
#include <fstream>
#include <ctype.h>
#include "DatalogProgram.h"
#include "Database.h"
#include "Scheme.h"
#include "Tuple.h"
#include "Relation.h"
class Interpreter {
public:
Interpreter();
~Interpreter();
void interpret(DataLog obj, char* filename);
vector<Tuple> add_facts(string id);
void add_relation();
void tuple_clear();
void eval_query();
void eval_rule();
bool is_string(string param);
string yes_no(set<Tuple> set);
void convergance();
vector<int> find_project_spots(vector<string> scheme, vector<string> scheme_head);
Relation bigjoin(Relation R, vector<Relation> all_relations);
private:
vector<string> variable_name;
vector<int> variable_pos;
vector<Tuple> tuple_vector;
vector<int> pos;
stringstream ss;
DataLog DL_obj;
Database DAT;
Relation REL;
map<string, Relation> Relations_;
vector<Predicate> schemes_;
vector<Predicate> facts_;
vector<Predicate> queries_;
vector<Rule> rules_;
};
#endif /* defined(__Project3__Interpreter__) */