We consider the problem of processing syntax errors in the compiler of the functional-imperative programming language El aimed at continuing syntactic parsing after a stop to find the maximum possible number of actually made errors. A combination of several well-known methods of neutralizing syntax errors is proposed. It is focused on the features of the deterministic parsing algorithm used in the translator. The compiler parser is implemented in the form of a stack automaton controlled by an input token and a symbol taken from the top of the stack. The proposed error neutralization method is based on a complete enumeration of all possible options for modifying one erroneous token – its alternate insertion, replacement and deletion to select such an option for restarting the automat in which the following syntax error is detected at the maximum distance from the initially detected error. If no modification of a single erroneous token leads to a successful neutralization, then in the proposed method, after each deletion of the input token, a set of valid tokens expands, calculated as an integration of multiple selection sets for symbols at the top of the automaton stack. This transition from processing a single error to processing a multiple error allows you to reduce the number of input tokens read by the parser without analysis as compared to the known panic mode. The proposed neutralization algorithm combines in the El-compiler with “rules for typical errors”, which are included in the grammar for such possible situations when, in order to successfully neutralize an error, you need to insert (or replace) not one, but two or three tokens.
1. Maliavko A. Novel functional-imperative programming language El: a brief introduction. Proceedings of the 2018 International Multi-Conference on Industrial Engineering and Modern Technologies (FarEastCon), Vladivostok, October 2018, pp. 1–7.
2. Crespi-Reghizzi S. Formal languages and compilation. London, Springer, 2009. 364 p.
3. Aho A., Lam M., Sethi R., Ullman J. Compilers: principles, techniques, and tools. Reading, Addison-Wesley, 2006. 795 p.
4. Maliavko A., Zhurkin P., Nagornov N. The functionally-imperative programming language El and its translator. 14th International Scientific-Technical Conference on Actual problems of Electronic Instrument Engineering (APEIE-2018), Novosibirsk, 2018, vol. 1, pt. 4, pp. 469–476.
5. Watson D. A practical approach to compiler construction. Springer, 2017. 254 p.
6. Carroll J., Long D. Theory of finite automata with an introduction to formal languages. New Jersey, Prentice Hall, 1989. 447 p.
7. Malyavko A.A. [Using web applications and web technologies in the development of educational software for studying methods of translation]. Sovremennoe obrazovanie: tekhnicheskie universitety v modernizatsii ekonomiki Rossii: materialy Mezhdunarodnoi nauchno-metodicheskoi konferentsii [Modern education: technical universities in the modernization of the Russian economy: materials of the International Scientific and Methodological Conference]. Tomsk, TUSUR Publ., 2011, pp. 45–47. (In Russian).
8. Meduna A. Formal languages and computation: models and their applications. Boca Raton, CRC Press, 2014. 315 p.
9. Rosenkrantz D., Stearns R. Properties of deterministic top down grammars. Information and Control, 1970, vol. 17 (3), pp. 226–256.
10. Waite W., Goos G. Compiler construction. Heidelberg, Springer, 2012.
11. Dos Reis A. Compiler construction using Java, JavaCC, and Yacc. Hoboken, Wiley & Sons, 2012. 664 p.
12. Maliavko A. Formal'nye yazyki i kompilyatory [Formal languages and compilers]. Moscow, Yurait Publ., 2017. 429 p.
13. Kumar R. Theory of automata, languages and computation. Tata, McGraw-Hill, 2010.
14. Medeiros S. Mascarenhas F. Syntax error recovery in parsing expression grammars. Applied computing 2018: the 33rd Annual ACM Symposium on Applied Computing. New York, 2018.
15. Cooper K., Torczon L. Engineering a compiler. San Francisco, Morgan Kaufmann, 2003.
16. Wilhelm R., Seidl H., Hack S. Compiler design: syntactic and semantic analysis. New York, Springer, 2013. 216 p.
17. Parr T., Harwell S., Fisher K. Adaptive LL(*) parsing: the power of dynamic analysis. Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications. New York, ACM, 2014, pp. 579–598.
18. Chandak M., Khurana K. Compiler design. Hyderabad, India, Universitet press, 2018. 480 p.
19. Grune R., Jacobs C. Parsing techniques: a practical guide. New York, Springer, 2007. 585 p.
20. Plaisted D. Source-to-source translation and software engineering. JSEA Special Issue on Software Dependability, 2013, vol. 6,no. 4A.
21. Afroozeh A., Izmaylova A. Faster, practical GLL parsing. Compiler Construction: 24th International Conference. Heidelberg, Springer, 2015, pp. 89–108.
22. Safonov V. Trustworthy compilers. Hoboken, Wiley & Sons, 2010. 317 p.
Maliavko A.A. Obrabotka oshibok v sintaksicheskom analizatore kompilyatora yazyka El [Errors handling in the parser for the El-language compiler].Nauchnyi vestnik Novosibirskogo gosudarstvennogo tekhnicheskogo universiteta – Science bulletin of the Novosibirsk state technical university, 2019, no. 2 (75), pp. 37–48. DOI: 10.17212/1814-1196-2019-2-37-48.