Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Escuela de Informática
Autores:
1052700911 – CRUZ OTINIANO, José Martin
1052700511 - FERNÁNDEZ SEGURA, Joel Cesar
Asesor:
José Luis Peralta Lujan
En el análisis léxico se especifican los tokens, los cuales se van a encargar de analizar
si un símbolo
símbolo pertenece
pertenece o no al lenguaje, nos ayudaremos
ayudaremos de la herramienta Flex.
Flex.
En el análisis
análisis sintáctico vamos
vamos a especificar
especificar la gramática libre del contexto para
nuestro lenguaje, nos apoyaremos de la herramienta Bison, adicionando código de C
para algunas funciones requeridas y se encargara de ver la estructura de las
sentencias y los tokens .
This report is focused on the design and implementation of an online compiler in order
to be able to perform calculations and test algorithms desktop using a simple
programming language. To develop it is necessary to use Flex and Bison tools which
are responsible for generating code for lexical and syntactic analyzers respectively. For
the design and implementation has to have the following structure which includes:
lexical analysis,
analysis, parsing and translation using syntax-directed translation schemes.
In the lexical analysis tokens, which will be in charge of analyzing whether or not a
symbol belongs to language, we will help the Flex tool specified.
In parsing we will specify the context-free grammar for our language, we will rely on the
Bison tool, adding C code required for some functions and be responsible to see the
structure of sentences and tokens.
The syntax-directed translation using translation schemes will parse adhered to,
specifically statements contain grammar and semantic rules, these rules often have C
code indicating the operations to perform.
To complete the development we will make a web environment which will be on a web
server and which we can enter the code to compile. This web environment would be
responsible
responsible for querying the compiler and get the results to be displayed.
Key words: Flex, Bison, Parsers, Scanners, Schema of translation, compiler online.
Tabla de Contenidos
RESUMEN ......................................
..........................................................
........................................
.........................................
........................................
.......................................
...........................
.......2
ABSTRACT .....................................
.........................................................
........................................
........................................
........................................
........................................
...........................
.......3
INTRODUCCIÓN ......................................
.........................................................
.......................................
.........................................
........................................
.................................
..............8
2.4.2. Atributos.....................................
.........................................................
........................................
.........................................
.........................................
...................... 18
CONCLUSIONES ................................................................................................................................37
RECOMENDACIONES .......................................................................................................................38
GLOSARIO ..........................................................................................................................................39
BIBLIOGRAFÍA ...................................................................................................................................40
Ilustración 4: Ejemplo de Árbol sintáctico. (Galvez Rojas & Mora Mata, 2005) ............ 14
Ilustración 7:Análisis sintáctico descendente para id+id*id (Aho, Lam, Sethi, & Ullman,
1998) ............................................................................................................................... 16
Ilustración 8: Traducción dirigida por la sintaxis. (Galvez Rojas & Mora Mata, 2005) . 18
1.1. Problema
Los procesadores del lenguaje son aplicaciones las cuales reciben como
entrada un lenguaje. Este concepto es abarcado por los traductores, ”Un
traductor se define como un programa que traduce o convierte desde un texto o
programa escrito en un lenguaje fuente hasta un texto o programa equivalente
escrito en un lenguaje destino produciendo, si cabe, mensajes de error ”
(Galvez Rojas & Mora Mata, 2005). Ver figura 1
Ilustración 4: Ejemplo de Árbol sintáctico. (Galvez Rojas & Mora Mata, 2005)
Derivación: proceso que consiste en sustituir el lado izquierdo por su lado derecho
Aho, A., Lam, M., Sethi, R., & Ullman, J. (1998). Compiladores: Principios, Tecnicas y
Herramientas 2 Edicion. New Jersey: Pearson.
Flex:
- Ingresar al siguiente link:
http://gnuwin32.sourceforge.net/packages/flex.htm
Bison:
- Ingresar al siguiente link:
http://gnuwin32.sourceforge.net/packages/bison.htm
- Descargar la ultima version
MinGW:
- MinGw es un compilador del lenguaje C/C++, trae librerías necesarias para la
ejecución de programas en C/C++
- Ingresar en el siguiente link
- http://www.mingw.org/category/wiki/download
- Descargar la versión para tu tipo de arquitectura x86 o x64