-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherr.c
More file actions
178 lines (169 loc) · 5.02 KB
/
err.c
File metadata and controls
178 lines (169 loc) · 5.02 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
/*
* A n t l r S e t s / E r r o r F i l e H e a d e r
*
* Generated from: cl.g
*
* Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001
* Parr Research Corporation
* with Purdue University Electrical Engineering
* With AHPCRC, University of Minnesota
* ANTLR Version 1.33MR33
*/
#define ANTLR_VERSION 13333
#include "pcctscfg.h"
#include "pccts_stdio.h"
#include <string>
#include <iostream>
#include <map>
#include <list>
#include <vector>
#include <fstream>
using namespace std;
#include <stdio.h>
#include <stdlib.h>
#include "ptype.hh"
#include "symtab.hh"
#include "codegest.hh"
/// struct to contain information about a token.
typedef struct {
string kind;
string text;
int line;
} Attrib;
/// function called by the scanner when a new token is found
/// Predeclared here, definition below.
void zzcr_attr(Attrib *attr,int type,char *text);
/// Include AST node fields declaration
#include "myASTnode.hh"
/// Macro called by the parser when a new AST node is to be created
/// createASTnode function doing the actual job is defined below.
#define zzcr_ast(as,attr,tttype,textt) as=createASTnode(attr,tttype,textt);
AST* createASTnode(Attrib* attr, int ttype, char *textt);
#define zzSET_SIZE 8
#include "antlr.h"
#include "ast.h"
#include "tokens.h"
#include "dlgdef.h"
#include "err.h"
ANTLRChar *zztokens[57]={
/* 00 */ "Invalid",
/* 01 */ "INPUTEND",
/* 02 */ "OPENANGL",
/* 03 */ "CLOSEANGL",
/* 04 */ "PROGRAM",
/* 05 */ "ENDPROGRAM",
/* 06 */ "PROCEDURE",
/* 07 */ "ENDPROCEDURE",
/* 08 */ "FUNCTION",
/* 09 */ "ENDFUNCTION",
/* 10 */ "RETURN",
/* 11 */ "VARS",
/* 12 */ "ENDVARS",
/* 13 */ "VAL",
/* 14 */ "REF",
/* 15 */ "INT",
/* 16 */ "STRUCT",
/* 17 */ "ENDSTRUCT",
/* 18 */ "BOOL",
/* 19 */ "CIERTO",
/* 20 */ "FALSO",
/* 21 */ "ARRAY",
/* 22 */ "OF",
/* 23 */ "WRITELN",
/* 24 */ "WRITE",
/* 25 */ "READ",
/* 26 */ "IF",
/* 27 */ "THEN",
/* 28 */ "ELSE",
/* 29 */ "ENDIF",
/* 30 */ "WHILE",
/* 31 */ "DO",
/* 32 */ "ENDWHILE",
/* 33 */ "GT",
/* 34 */ "EQ",
/* 35 */ "LT",
/* 36 */ "AND",
/* 37 */ "OR",
/* 38 */ "NOT",
/* 39 */ "DIV",
/* 40 */ "MINUS",
/* 41 */ "TIMES",
/* 42 */ "PLUS",
/* 43 */ "OPENPAR",
/* 44 */ "CLOSEPAR",
/* 45 */ "OPENKEY",
/* 46 */ "CLOSEKEY",
/* 47 */ "ASIG",
/* 48 */ "DOT",
/* 49 */ "COMMA",
/* 50 */ "IDENT",
/* 51 */ "INTCONST",
/* 52 */ "STRING",
/* 53 */ "COMMENT",
/* 54 */ "WHITESPACE",
/* 55 */ "NEWLINE",
/* 56 */ "LEXICALERROR"
};
SetWordType zzerr1[8] = {0xe4,0xd,0x80,0x47, 0x0,0x0,0x4,0x0};
SetWordType zzerr2[8] = {0x40,0x1,0x0,0x0, 0x0,0x0,0x0,0x0};
SetWordType setwd1[57] = {0x0,0x1,0xc6,0x0,0x0,0xc6,0xa6,
0xc6,0xa6,0x0,0xc6,0x0,0x18,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0xc6,0xc6,0xc6,0xc6,0x0,0x0,0x0,0xc6,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0xd6,0x0,0x0,0x0,0x0,
0x0,0x0};
SetWordType zzerr3[8] = {0x0,0x60,0x0,0x0, 0x0,0x10,0x0,0x0};
SetWordType zzerr4[8] = {0x0,0x60,0x0,0x0, 0x0,0x0,0x0,0x0};
SetWordType zzerr5[8] = {0x0,0x80,0x25,0x0, 0x0,0x0,0x0,0x0};
SetWordType setwd2[57] = {0x0,0x0,0xa3,0x0,0x0,0x0,0x23,
0x2,0x23,0x0,0x21,0x23,0x20,0x4,0x4,
0x0,0x0,0x60,0x0,0x0,0x0,0x0,0x0,
0xa3,0xa3,0xa3,0xa3,0x0,0x0,0x0,0xa3,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x38,0x0,0x0,
0x0,0x0,0x30,0xe3,0x0,0x0,0x0,0x0,
0x0,0x0};
SetWordType zzerr6[8] = {0xc,0x0,0x18,0x0, 0x40,0x19,0xc,0x0};
SetWordType zzerr7[8] = {0x0,0x0,0x0,0x0, 0x0,0xa8,0x1,0x0};
SetWordType zzerr8[8] = {0x0,0x0,0x80,0x1, 0x0,0x0,0x0,0x0};
SetWordType zzerr9[8] = {0x4,0x0,0x18,0x0, 0x40,0x9,0x1c,0x0};
SetWordType zzerr10[8] = {0x4,0x0,0x80,0x47, 0x0,0x0,0x4,0x0};
SetWordType setwd3[57] = {0x0,0x0,0x82,0xc,0x0,0x1,0x0,
0x1,0x0,0x0,0x1,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x82,0x82,0x0,0x0,
0x40,0x40,0x0,0x0,0x0,0x1,0x1,0x0,
0x0,0x1,0x0,0x0,0x0,0x0,0x0,0x82,
0x0,0x82,0x0,0x0,0x82,0xc,0x30,0x0,
0x10,0x30,0x0,0x82,0x82,0x0,0x0,0x0,
0x0,0x0};
SetWordType zzerr11[8] = {0x0,0x0,0x0,0x30, 0x0,0x0,0x0,0x0};
SetWordType zzerr12[8] = {0xac,0x6,0x80,0xff, 0x3f,0x50,0x6,0x0};
SetWordType setwd4[57] = {0x0,0x0,0x77,0x70,0x0,0x77,0x0,
0x77,0x0,0x70,0x77,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x77,0x77,0x77,0x77,0x70,0x77,0x77,0x77,
0x70,0x77,0x0,0x0,0x0,0x68,0x68,0x0,
0x0,0x80,0x0,0x80,0x0,0x70,0x0,0x70,
0x0,0x0,0x70,0x77,0x0,0x0,0x0,0x0,
0x0,0x0};
SetWordType zzerr13[8] = {0x4,0x0,0x18,0x0, 0x40,0x9,0xc,0x0};
SetWordType zzerr14[8] = {0x4,0x0,0x18,0x0, 0x0,0x8,0xc,0x0};
SetWordType zzerr15[8] = {0x4,0x0,0x18,0x0, 0x0,0x0,0xc,0x0};
SetWordType setwd5[57] = {0x0,0x0,0x7d,0x55,0x0,0x55,0x0,
0x55,0x0,0x55,0x55,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x28,0x28,0x0,0x0,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x0,
0x52,0x54,0x52,0x54,0x88,0x55,0x80,0x55,
0x0,0x80,0x55,0x7d,0x28,0x0,0x0,0x0,
0x0,0x0};
SetWordType setwd6[57] = {0x0,0x0,0x1,0x1,0x0,0x1,0x0,
0x1,0x0,0x1,0x1,0x0,0x0,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x1,
0x1,0x1,0x1,0x1,0x1,0x1,0x1,0x0,
0x1,0x1,0x1,0x1,0x0,0x1,0x0,0x1,
0x0,0x0,0x1,0x1,0x0,0x0,0x0,0x0,
0x0,0x0};