-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSymbolStack.h
More file actions
45 lines (37 loc) · 926 Bytes
/
Copy pathSymbolStack.h
File metadata and controls
45 lines (37 loc) · 926 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
42
43
44
#ifndef _GP_SYMBOL_STACK_H
#define _GP_SYMBOL_STACK_H
#include <vector>
#include "Symbol.h"
using namespace std;
class SymbolStack {
public:
bool empty() const
{return (c.empty()); }
int size() const
{return (c.size()); }
Symbol* top()
{return (c.back()); }
const Symbol* top() const
{return (c.back()); }
void push(Symbol* x)
{c.push_back(x); }
void pop()
{c.pop_back(); }
bool operator==(const SymbolStack& x) const
{return (c == x.c); }
bool operator!=(const SymbolStack& x) const
{return (!(*this == x)); }
bool operator<(const SymbolStack& x) const
{return (c < x.c); }
bool operator>(const SymbolStack& x) const
{return (x < *this); }
bool operator<=(const SymbolStack& x) const
{return (!(x < *this)); }
bool operator>=(const SymbolStack& x) const
{return (!(*this < x)); }
vector <Symbol*> get_vector ()
{return c;}
protected:
vector <Symbol*> c;
};
#endif