-
Notifications
You must be signed in to change notification settings - Fork 84
/
anlex.h
75 lines (68 loc) · 1.54 KB
/
anlex.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
/*********** Librerias utilizadas **************/
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
/************* Definiciones ********************/
//Codigos
#define PROGRAM 256
#define TYPE 257
#define VAR 258
#define ARRAY 259
#define BEGIN 260
#define END 261
#define PR_DO 262
#define TO 263
#define DOWNTO 264
#define THEN 265
#define OF 266
#define FUNCTION 267
#define PROCEDURE 268
#define PR_INTEGER 269
#define PR_REAL 270
#define PR_BOOLEAN 271
#define PR_CHAR 272
#define PR_FOR 273
#define PR_IF 274
#define PR_ELSE 275
#define PR_WHILE 276
#define REPEAT 277
#define UNTIL 278
#define PR_CASE 279
#define RECORD 280
#define WRITELN 281
#define WRITE 282
#define CONST 283
#define NUM 284
#define ID 285
#define BOOL 286
#define CAR 287
#define LITERAL 288
#define NOT 289
#define OPREL 290
#define OPSUMA 291
#define OPMULT 292
#define OPASIGNA 293
#define USER_TYPE 294
// Fin Codigos
#define TAMBUFF 5
#define TAMLEX 50
#define TAMHASH 101
/************* Estructuras ********************/
typedef struct entrada{
//definir los campos de 1 entrada de la tabla de simbolos
int compLex;
char lexema[TAMLEX];
struct entrada *tipoDato; // null puede representar variable no declarada
// aqui irian mas atributos para funciones y procedimientos...
} entrada;
typedef struct {
int compLex;
entrada *pe;
} token;
/************* Prototipos ********************/
void insertar(entrada e);
entrada* buscar(const char *clave);
void initTabla();
void initTablaSimbolos();
void getToken();