Published

2003-07-01

Strategy for syntax error recovering

Nueva estrategia para la recuperación de errores sintácticos

DOI:

https://doi.org/10.15446/ing.investig.v23n3.14698

Keywords:

compiler, syntax analizer, grammar, syntax error recovering (en)
compilador, analizador, sintáctico, gramática, recuperación de errores sintácticos (es)

Authors

  • Henry F Báez .
  • Juan G Vargas .

This paper describes a new strategy for syntax error recovering for a complier that does not have instruction separators like ‘;’ or opening and closing brackets like ‘{‘and ‘}’: This strategy is based on 4 steps. 1. Find set of tokens (called ACEPTA set) for each non terminal symbol of the grammar 2. During the syntax analysis of each non terminal symbol, eliminate the tokens that are not in the ACEPTA set. 3. Eliminate repeated tokens that are not accepted by the grammar, and 4. Complete symbols in the syntax analysis with the hope that the token that has not been erased later will match with a terminal symbol expected by the syntax analyzer; otherwise the symbol will be eliminated in some particular productions. The strategy for syntax error recovering is a method that can be used in whatever not ambiguous context free grammar including those that use instruction separators like ‘;’. It is implemented with an algorithm and it is much more easy to implement than other strategies for syntax error recovering like those based on stacks.

Este artículo describe una nueva estrategia de recuperación de errores sintácticos para un compilador de lenguaje que no utiliza separadores de instrucciones como el punto y coma ‘;’ o los corchetes de apertura ‘{‘de cierre ‘}’. Esta estrategia se desarrolla en 4 pasos: 1. encontrar un conjunto de tokens (llamado conjunto ACEPTA) para cada símbolo no terminal de la gramática; 2. en el análisis sintáctico de cada símbolo no terminal, se eliminan toquen que no se encuentren en el conjunto ACEPTA; 3. eliminar tokens repetidos que no son aceptados por la gramática y 4. completar símbolos en el análisis sintáctico con la esperanza que el token que no se ha borrado coincidirá más adelante con un símbolo terminal esperado por el análisis sintáctico. En caso contrario, el token se eliminará en algunas producciones determinadas. La estrategia de recuperación de errores sintácticos es una metodología que puede usarse en cualquier gramática libre de contexto y no ambigua, incluso en las que utilizan separadores de instrucciones como el ‘;’. Se implementa de forma algorítmica y es mucho más fácil de implementar que otras estrategias clásicas como las basadas en pilas.

References

Aho, A.; Sethi, R., and Ullman J. (1990), Compiladores, principios técnicas y herramientas. Wilmington, Delaware, USA: Addison-Wesley

Lemone, K. (1996). Fundamentos de compiladores, como traducir al lenguaje de computadora. Primera edición. México D.F: Continental.

Pittman, T. and Peters I. (1992). The Art of Compiler Design, Theory and Practice. New Jersey: Prentice Hall.

Pressman, R. (1994). Ingeniería del software, un enfoque práctico. Tercera edición. Madrid: McGraw Hill.

Sethi, R. (1991). Lenguajes de programación conceptos y constructores. México: Addison Wesley.

Schmidt, S.; Teufel, B., and Teufel, T. (1995). Compiladores, conceptos fundamentales. Wilmington, Delaware, USA: Addison-Wesley.

Trembay, I., and Sorenson, P (1996). Tehg theory and practice of compiler writing. 11 edition. Saskatoon, Canada: McGraw Hill,

How to Cite

APA

Báez, H. F. and Vargas, J. G. (2003). Strategy for syntax error recovering. Ingeniería e Investigación, 23(3), 23–30. https://doi.org/10.15446/ing.investig.v23n3.14698

ACM

[1]
Báez, H.F. and Vargas, J.G. 2003. Strategy for syntax error recovering. Ingeniería e Investigación. 23, 3 (Jul. 2003), 23–30. DOI:https://doi.org/10.15446/ing.investig.v23n3.14698.

ACS

(1)
Báez, H. F.; Vargas, J. G. Strategy for syntax error recovering. Ing. Inv. 2003, 23, 23-30.

ABNT

BÁEZ, H. F.; VARGAS, J. G. Strategy for syntax error recovering. Ingeniería e Investigación, [S. l.], v. 23, n. 3, p. 23–30, 2003. DOI: 10.15446/ing.investig.v23n3.14698. Disponível em: https://revistas.unal.edu.co/index.php/ingeinv/article/view/14698. Acesso em: 23 apr. 2024.

Chicago

Báez, Henry F, and Juan G Vargas. 2003. “Strategy for syntax error recovering”. Ingeniería E Investigación 23 (3):23-30. https://doi.org/10.15446/ing.investig.v23n3.14698.

Harvard

Báez, H. F. and Vargas, J. G. (2003) “Strategy for syntax error recovering”, Ingeniería e Investigación, 23(3), pp. 23–30. doi: 10.15446/ing.investig.v23n3.14698.

IEEE

[1]
H. F. Báez and J. G. Vargas, “Strategy for syntax error recovering”, Ing. Inv., vol. 23, no. 3, pp. 23–30, Jul. 2003.

MLA

Báez, H. F., and J. G. Vargas. “Strategy for syntax error recovering”. Ingeniería e Investigación, vol. 23, no. 3, July 2003, pp. 23-30, doi:10.15446/ing.investig.v23n3.14698.

Turabian

Báez, Henry F, and Juan G Vargas. “Strategy for syntax error recovering”. Ingeniería e Investigación 23, no. 3 (July 1, 2003): 23–30. Accessed April 23, 2024. https://revistas.unal.edu.co/index.php/ingeinv/article/view/14698.

Vancouver

1.
Báez HF, Vargas JG. Strategy for syntax error recovering. Ing. Inv. [Internet]. 2003 Jul. 1 [cited 2024 Apr. 23];23(3):23-30. Available from: https://revistas.unal.edu.co/index.php/ingeinv/article/view/14698

Download Citation

CrossRef Cited-by

CrossRef citations0

Dimensions

PlumX

Article abstract page views

356

Downloads

Download data is not yet available.