-
Notifications
You must be signed in to change notification settings - Fork 0
/
lisp.hpp
52 lines (47 loc) · 850 Bytes
/
lisp.hpp
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
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <fstream>
#include <boost/regex.hpp>
using namespace std;
namespace lisp{
class Lisp{
ifstream fin;
string buf;
int index;
int depth;
bool isInt(string s);
string lexInt();
int stoi(string s);
int eval();
int plus();
int mul();
int sub();
int div();
public:
Lisp(char *file);
virtual ~Lisp();
void lmain();
};
union _Value{
double type_d;
int type_i;
char type_c;
string *type_s;
void *point;
};
typedef union _Value VALUE;
enum _TYPE{NIL,INT,DOUBLE,STRING,KLASS,NODE};
typedef enum _TYPE TYPE;
class Node
{
VALUE value;
TYPE nodetype;
Node *next;
public:
Node();
Node(Node *next, TYPE nodetype, VALUE value);
virtual ~Node();
};
}