-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterprete.c
More file actions
48 lines (40 loc) · 927 Bytes
/
interprete.c
File metadata and controls
48 lines (40 loc) · 927 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
45
46
47
48
//
// Created by ignacio on 24/03/25.
//
#include "stdio.h"
#include "interprete.h"
#include "flex.yy.h"
#include "bison.tab.h"
#include "comandos.h"
#include "pila.h"
// Variables globales
int profundidadPila = 0;
pila pilaFicheros;
void interprete(char* arg) {
clean();
printf(AMARILLO"\nBienvenido al intérprete. Si necesitas ayuda, teclea ? o help().\n\n"RESET);
// Si hay script de entrada, se carga
if (arg != NULL) {
load(arg);
}
crearPila(&pilaFicheros);
// Comienza el análisis sintáctico y léxico
yyparse();
}
void push_wrapper(tipoelemPila E) {
push(&pilaFicheros, E);
profundidadPila++;
}
void pop_wrapper() {
pop(&pilaFicheros);
profundidadPila--;
}
unsigned esVaciaPila_wrapper() {
return esVaciaPila(pilaFicheros);
}
tipoelemPila tope_wrapper() {
return tope(pilaFicheros);
}
int consultar_profundidad() {
return profundidadPila;
}