Generating sample code snippets from Lark grammar specifications
Master thesis
View/ Open
Date
2022-10-25Metadata
Show full item recordCollections
- Master theses [220]
Abstract
Programming languages are the basis of computer science and are extensively used in computer science education. Many educational materials, such as tutorials, constantly appear on the market with the goal of targeting various user groups. These tutorials, however, oftentimes present language constructs in inconsistent ways, with constructs completely missing from some of the tutorials. This makes it difficult for a language learner to get a holistic overview of the language. In this thesis, we focus on syntax of programming languages, specified in a form of context-free grammars, and design an algorithm to generate syntactically correct sample code snippets written in the language in question. Our algorithm can be used to comprehensively explore constructs of a programming language. We test our prototype implementation of the designed algorithm on several grammars, including a tiny model programming language and a children-oriented programming language Hedy.