SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
2.
Analizador Sintáctico Analizador Léxico Analizador sintáctico Tabla de Símbolos Componente Léxico (Token) GetNextToken() Programa Fuente Arbol de Análisis Sintáctico Resto de Etapa Inicial Código Intermedio
3.
Errores <ul><li>Léxicos </li></ul><ul><ul><li>Escribir mal algo (fi en lugar de if) </li></ul></ul><ul><li>Sintácticos </li></ul><ul><ul><li>Paréntesis no equilibrados </li></ul></ul><ul><ul><li>If sin Then </li></ul></ul><ul><li>Semáticos </li></ul><ul><ul><li>Llamada a función con parámetros de tipo incorrecto </li></ul></ul><ul><li>Lógicos </li></ul><ul><ul><li>Recursión infinita </li></ul></ul><ul><ul><li>Run time error </li></ul></ul>
4.
Errores Sintácticos <ul><li>Objetivos </li></ul><ul><ul><li>Informar de los errores con claridad </li></ul></ul><ul><ul><ul><li>Lugar donde ocurrió el error </li></ul></ul></ul><ul><ul><li>Recuperarse de los errores </li></ul></ul><ul><ul><ul><li>Varias estrategias </li></ul></ul></ul><ul><ul><li>No retrasar el análisis en programas correctos </li></ul></ul>
5.
Programa ejemplo <ul><li>Program impmax(input, output); </li></ul><ul><li>Var </li></ul><ul><li>x, y : integer; </li></ul><ul><li>Function max(i: integer; j: integer) : integer; </li></ul><ul><li>{devuelve el máximo de los enteros i y j} </li></ul><ul><li>Begin </li></ul><ul><li>if i > j then max := i </li></ul><ul><li>else max := j </li></ul><ul><li>End; </li></ul><ul><li>Begin </li></ul><ul><li>readln(x,y); </li></ul><ul><li>writeln(max(x,y)) </li></ul><ul><li>End. </li></ul>
6.
Estrategias de recuperación de errores <ul><li>En modo de pánico </li></ul><ul><li>A nivel de frase </li></ul><ul><li>De producciones de error </li></ul><ul><li>De corrección global </li></ul>
7.
En modo de pánico <ul><li>Se descubre el error </li></ul><ul><li>Se desechan símbolos de entrada </li></ul><ul><li>Se llega a un componente de sincronización </li></ul><ul><ul><li>; end loop then </li></ul></ul><ul><ul><li>Se debe definir cuáles se usarán </li></ul></ul><ul><li>Puede desechar gran parte de la entrada </li></ul><ul><li>Garantiza recuperación </li></ul>
8.
A nivel de frase <ul><li>Identificar prefijo para la entrada restante </li></ul><ul><li>Ejemplo </li></ul><ul><ul><li>If while not true then ... </li></ul></ul><ul><ul><li>Entrada restante: not true then... </li></ul></ul><ul><ul><li>Prefijo identificable: if </li></ul></ul><ul><ul><li>Corrección: if not true then ... </li></ul></ul><ul><li>Difícil de implementar </li></ul>
9.
Producciones de error <ul><li>Se identifican patrones de error </li></ul><ul><li>Se incluyen producciones para esos patrones </li></ul><ul><li>Si la producción se usa... </li></ul><ul><ul><li>Corregir en reglas semánticas </li></ul></ul><ul><li>Modificar la gramática </li></ul>
10.
Corrección Global <ul><li>Identificar todas las posibles variaciones </li></ul><ul><li>Evaluar la mínima </li></ul><ul><li>Utilizarla </li></ul>
0 likes
Be the first to like this
Views
Total views
6,515
On SlideShare
0
From Embeds
0
Number of Embeds
52
You have now unlocked unlimited access to 20M+ documents!
Unlimited Reading
Learn faster and smarter from top experts
Unlimited Downloading
Download to take your learnings offline and on the go
You also get free access to Scribd!
Instant access to millions of ebooks, audiobooks, magazines, podcasts and more.
Read and listen offline with any device.
Free access to premium services like Tuneln, Mubi and more.