AALanguage
The best language for those who have nothing to do
Loading...
Searching...
No Matches
Poliz.h
Go to the documentation of this file.
1#pragma once
2
3#include <vector>
4#include <stack>
5#include "TableIdentifiers.h"
6#include <iostream>
7#include "Large.h"
8#include <chrono>
9#include <random>
10
12class Poliz {
13public:
22
24 Poliz() {}
32 ~Poliz();
38 void put_lex(std::pair<PolizType, void*> l);
40 void blank();
46 int get_size();
55 void* convert(std::pair<PolizType, void*> op, PolizType to);
66 std::pair<PolizType, std::pair<void*, void*>> make_same(std::pair<PolizType, void*> op1, std::pair<PolizType, void*> op2);
76 std::pair<PolizType, void*> address_to_value(void* ptr);
84 void* copy_value(void* ptr);
104 std::pair<PolizType, void*> execute_operation(std::pair<PolizType, void*> op1, std::pair<PolizType, void*> op2, std::string operation);
113 std::pair<PolizType, void*> execute_operation(std::pair<PolizType, void*> op, std::string operation);
122 void call_function(std::stack<std::pair<PolizType, void*>>& st, int& p);
132 std::pair<PolizType, void*> execute(Function entry_func);
140 std::pair<PolizType, void*>& operator[](int ind) {
141 return lexes[ind];
142 }
143private:
144 std::vector<std::pair<PolizType, void*>> lexes;
145 int literal_prior[12] = { 0, 2, 1, 11, 7, 5, 9, 3, 0, 6, 10, 12 };
146 std::stack<std::pair<int, PolizType>> func_calls;
147 std::vector<std::pair<PolizType, void*>> global_lexes;
148 std::stack<std::vector<std::pair<Identifier*, void*>>> tid_vals;
149 std::mt19937 rnd;
151
152 ExprType string_to_type(std::string str);
153 std::string ReplaceAll(std::string str, const std::string& from, const std::string& to);
154 void add_tid_values(TableIdentifiers* current_tid, bool is_first = true);
155 void clear_tid_values(TableIdentifiers* current_tid);
156 void restore_tid_values();
157};