A Software Module for Working with Context-Free Grammars
Abstract
The article presents the development of an educational software module to support the initial stage of learning formal grammars. The developed module allows the student or teacher to describe a given language through context-free grammar. In the process of completing a grammar assignment, the module provides an interactive response to the differences between the constructed grammar and the reference one. The main technical problem that the authors solved is related to the fact that there is no algorithm for determining the equivalence of two context-free grammars. Therefore, the module must generate in real time a sufficiently large number of words of a language of different lengths in order to detect differences between the proposed grammar and the reference one with a high probability. In the work, several word generation algorithms were analyzed, after which the algorithm most appropriate to the conditions of use of the module was selected. The developed module can be used for conducting Olympiads in discrete mathematics and computer science for schoolchildren and students, as well as to support students’ independent work on the topic "Formal languages and grammars".
References
N. Chomsky, “Syntactic Structures,” New in linguistics, vol. 2, pp. 412–527, 1962 (in Russian).
B. K. Martynenko, Languages and translations, St. Petersburg, Russia: SPbGU Publ., 2013 (in Russian).
Jetbrains MPS, “Meta Programming System,” in www.jetbrains.com, 2024. [Online]. Available: https://www.jetbrains.com/mps/
Xtext Eclipse, “Language Engineering For Everyone!,” in eclipse.dev, 2024. [Online]. Available: https://eclipse.dev/Xtext/
ANTLR, “Quick Start,” in www.antlr.org, 2024. [Online]. Available: https://www.antlr.org
“Extended Backus–Naur Form,” in ru.wikipedia.org, 2024 (in Russian). [Online]. Available: https://ru.wikipedia.org/w/index.php?title=Расширенная_форма_Бэкуса_—_Наура&stable=1
N. Wirth, Algorithms and Data Structures, Мoscow: DMK press, 2010 (in Russian).
ITMO University, “Cocke-Younger-Kasami algorithm,” in neerc.ifmo.ru, 2022 (in Russian). [Online]. Available: https://neerc.ifmo.ru/wiki/index.php?title=Алгоритм_Кока-ЯнгераКасами_разбора_грамматики_в_НФХ
ITMO University, “Chomsky normal form,” in neerc.ifmo.ru, 2022 (in Russian). [Online]. Available: https://neerc.ifmo.ru/wiki/index.php?title=Нормальная_форма_Хомского
A. Sorokin, Earley algorithm, in homepage.mi-ras.ru, 2013 (in Russian). [Online]. Available: https://homepage.mi-ras.ru/~sk/lehre/fivt2013/Earley.pdf
This work is licensed under a Creative Commons Attribution 4.0 International License.