aboutsummaryrefslogtreecommitdiff
path: root/lexer.py
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-11-06 23:17:19 -0600
committerIván Ávalos <avalos@disroot.org>2022-11-06 23:17:19 -0600
commita7142bce0e17b4fdd5cae33e6ef0140a109a496a (patch)
tree5819347ac8c8a41e88250beb4611d4b39a13621b /lexer.py
parent36aebb9be7903b9461d332e72102e4b4beb39ba6 (diff)
downloadjavanol-a7142bce0e17b4fdd5cae33e6ef0140a109a496a.tar.gz
javanol-a7142bce0e17b4fdd5cae33e6ef0140a109a496a.tar.bz2
javanol-a7142bce0e17b4fdd5cae33e6ef0140a109a496a.zip
Se eliminan residuos
Diffstat (limited to 'lexer.py')
-rw-r--r--lexer.py44
1 files changed, 1 insertions, 43 deletions
diff --git a/lexer.py b/lexer.py
index 49d75df..168858e 100644
--- a/lexer.py
+++ b/lexer.py
@@ -1,34 +1,9 @@
from enum import Enum
from symbol import LexToken, TablaLex, tokens
-t_boolean = 'booleano'
-t_break = 'detener'
-t_char = 'caracter'
-t_double = 'doble'
-t_else = 'si no'
-t_for = 'por cada'
-t_ident = r'[a-zA-Z_][a-zA-Z0-9_]?'
-t_if = 'si'
-t_int = 'entero'
-t_print = 'imprimir'
-t_read = 'leer'
-t_return = 'retorna'
-t_string = 'cadena'
-t_void = 'vacio'
-t_while = 'mientras'
-
-t_boolean_lit = r'verdadero|falso'
-t_char_lit = r'\'[[:print:]]\''
-t_double_lit = r'\d+.\d+'
-t_int_lit = r'\d+'
-t_string_lit = r'"[[:print]]*"'
-
def inicio_lexer(data):
tabla = TablaLex()
- es_string = False
- es_caracter = False
- es_comentario = False
selector = ''
recol_string = ''
recol_caracter = ''
@@ -129,22 +104,5 @@ def inicio_lexer(data):
recol_comentario = ''
continue
+ # Imprimir tabla de símbolos
print (str(tabla))
-
- '''
- tabla = TablaLex()
- # booleano ivan = verdadero
- tabla.insertar(LexToken('BOOLEAN', None, None, 1))
- tabla.insertar(LexToken('IDENT', 'ivan', None, 1))
- tabla.insertar(LexToken('=', None, None, 1))
- tabla.insertar(LexToken('BOOLEAN_LIT', None, True, 1))
- print (str(tabla))
-
- ident = tabla.buscar('ivan')
- print (str(ident))
-
- ident.valor = True
- tabla.actualizar('ivan', ident)
- ident = tabla.buscar('ivan')
- print (str(ident))
- '''