Strategy for syntax error recovering
Nueva estrategia para la recuperación de errores sintácticos
DOI:
https://doi.org/10.15446/ing.investig.v23n3.14698Keywords:
compiler, syntax analizer, grammar, syntax error recovering (en)compilador, analizador, sintáctico, gramática, recuperación de errores sintácticos (es)
Downloads
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
ACM
ACS
ABNT
Chicago
Harvard
IEEE
MLA
Turabian
Vancouver
Download Citation
License
Copyright (c) 2003 Henry F Báez, Juan G Vargas
This work is licensed under a Creative Commons Attribution 4.0 International License.
The authors or holders of the copyright for each article hereby confer exclusive, limited and free authorization on the Universidad Nacional de Colombia's journal Ingeniería e Investigación concerning the aforementioned article which, once it has been evaluated and approved, will be submitted for publication, in line with the following items:
1. The version which has been corrected according to the evaluators' suggestions will be remitted and it will be made clear whether the aforementioned article is an unedited document regarding which the rights to be authorized are held and total responsibility will be assumed by the authors for the content of the work being submitted to Ingeniería e Investigación, the Universidad Nacional de Colombia and third-parties;
2. The authorization conferred on the journal will come into force from the date on which it is included in the respective volume and issue of Ingeniería e Investigación in the Open Journal Systems and on the journal's main page (https://revistas.unal.edu.co/index.php/ingeinv), as well as in different databases and indices in which the publication is indexed;
3. The authors authorize the Universidad Nacional de Colombia's journal Ingeniería e Investigación to publish the document in whatever required format (printed, digital, electronic or whatsoever known or yet to be discovered form) and authorize Ingeniería e Investigación to include the work in any indices and/or search engines deemed necessary for promoting its diffusion;
4. The authors accept that such authorization is given free of charge and they, therefore, waive any right to receive remuneration from the publication, distribution, public communication and any use whatsoever referred to in the terms of this authorization.