-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrontend.h
75 lines (49 loc) · 1.39 KB
/
frontend.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
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef FRONTEND_H_INCLUDED
#define FRONTEND_H_INCLUDED
//#include "C:\TXLib\TX\TXLib.h"
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cassert>
#include <sys/types.h>
#include <sys/stat.h>
#include "tree.h"
const int KOSTYL = 2;
const int EXTRA = 1;
const int MAX_TKN_CUNT = 350;
enum strncmp
{
EQUAL = 0
};
struct tkn_arr
{
Node* node = NULL;
int n_cunt = 0;
int current_node = 0;
};
struct buffer
{
char* data = NULL;
int size = 0;
int pos = 0;
};
tkn_arr* GetAllTokens (FILE* inputfile, buffer* buf);
void GetTokens (buffer* buf, tkn_arr* array);
void PrintAllTokens (tkn_arr* array);
Node* GetG (tkn_arr* tk_array);
Node* GetStmts (tkn_arr* tk_array);
Node* GetStmt (tkn_arr* tk_array);
Node* GetE (tkn_arr* tk_array);
Node* GetT (tkn_arr* tk_array);
Node* GetP (tkn_arr* tk_array);
Node* GetN (tkn_arr* tk_array);
Node* GetV (tkn_arr* tk_array);
Node* GetArgs (tkn_arr* tk_array);
Node* GetArgsCall (tkn_arr* tk_array);
Node* GetArg (tkn_arr* tk_array);
void Require (char ch, tkn_arr* tk_array);
void SyntaxERROR (const char* s);
Node* CreateNode (int node_type);
#endif