Abstract
In the present day, computer programs are written in high level languages and parsed syntactically as part of a compilation process. These parsers are defined with context-free grammars (CFGs), a language recogniser for the respective programming language. Formal grammars in general are used for language recognition or generation. In this paper we present the automatic generation of procedural programs in Python using a CFG. We have defined CFG rules to model program templates and implemented these rules to produce infinitely many distinct practice programs in Python. Each generated program is designed to test a novice programmer’s knowledge of functions, expressions, loops, and/or conditional statements. The CFG rules are highly generic and can be extended to generate programs in other procedural languages. The resulting programs can be used as practice, test or examination problems in introductory programming courses. 500,000 iterations of generated programs can be found at: https://tinyurl.com/pythonprogramgenerator. A survey of 103 students’ perception showed that 93.1% strongly agreed that these programs can help them in practice and improve their programming skills.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Electives are courses not in the mainstream of the offered degree. An example is a student studying towards a Bachelor’s degree in Chemistry, who takes an introductory programming course in Python.
- 2.
Java ranked first.
- 3.
- 4.
References
Ade-Ibijola, A.: Synthesis of regular expression problems and solutions. Int. J. Comput. Appl. 1–17 (2018) https://doi.org/10.1080/1206212X.2018.1482398
Ade-Ibijola, A.: Synthesis of social media profiles using a probabilistic context-free grammar. In: PRASA-RobMech 2017, Proceedings of Pattern Recognition Association of South Africa and Robotics and Mechatronics, pp. 104–109. IEEE (2017)
Ade-Ibijola, A., Ewert, S., Sanders, I.: Abstracting and narrating novice programs using regular expressions. In: SAICSIT 2014, Proceedings of Annual Conference of the South African Institute for Computer Scientist and Information Technologists, pp. 19–28. ACM (2014)
Ahmed, U.Z., Gulwani, S., Karkare, A.: Automatically generating problems and solutions for natural deduction. In: Proceedings of IJCAI 2013, pp. 1968–1975 (2013)
Aho, A.V., Sethi, R., Ullman, J.D.: Compilers: Principles, Techniques, and Tools. Addison-Wesley, Boston (1986)
Alqadi, B.S., Maletic, J.I.: An empirical study of debugging patterns among novices programmers. In: Proceedings of the 2017 ACM SIGCSE Technical Symposium on Computer Science Education, pp. 15–20 (2017)
Baker, A., Zhang, J., Caldwell, E.R.: Reinforcing array and loop concepts through a game-like module. In: CGAMES 2012, Proceedings of 17th International Conference on Computer Games, pp. 175–179. IEEE (2012)
Bergin, S., Mooney, A., Ghent, J., Quille, K.: Using machine learning techniques to predict introductory programming performance. Int. J. Comput. Sci. Softw. Eng. 4(12), 323–328 (2015)
Butler, M., Morgan, M.: Learning challenges faced by novice programming students studying high level and low feedback concepts. In: Proceedings of 24th ASCILITE Conference, pp. 2–5 (2007)
Dale, N.B.: Most difficult topics in CS1: results of an online survey of educators. ACM SIGCSE Bull. 38(2), 49–53 (2006)
Fincher, S.: What are we doing when we teach programming? In: Proceedings of 29th Annual Frontiers in Education Conference, p. 12A4 (1999)
Foote, S.: Learning to Program. Addison-Wesley, Boston (2014)
Gulwani, S., Korthikanti, V.A., Tiwari, A.: Synthesizing geometry constructions. ACM SIGPLAN Not. 46(6), 50–61 (2011)
Haiduc, S., Aponte, J., Marcus, A.: Supporting program comprehension with source code summarization. In: ICSE 2010, Proceedings of 32nd International Conference on Software Engineering, pp. 223–226 (2010)
Hill, G.J.: Review of a problems-first approach to first year undergraduate programming. In: Kassel, S., Wu, B. (eds.) Software Engineering Education Going Agile, pp. 73–80. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-29166-6_11
Iqbal-Malik, S.: Role of ADRI model in teaching and assessing novice programmers. Technical report, Deakin University (2016)
Jenkins, T.: On the difficulty of learning to program. In: Proceedings of 3rd Annual Conference of the LTSN Centre for Information and Computer Sciences, pp. 53–58 (2002)
Johnson, W.L.: Understanding and debugging novice programs. Artif. Intell. 42(1), 51–97 (1990)
Lahtinen, E., Ala-Mutka, K., Järvinen, H.M.: A study of the difficulties of novice programmers. ACM SIGCSE Bull. 37(3), 14–18 (2005)
Lucariello, J.M., Nastasi, B.K., Anderman, E.M., Dwyer, C., Ormiston, H., Skiba, R.: Science supports education: the behavioral research base for psychology’s top 20 principles for enhancing teaching and learning. Mind Brain Educ. 10(1), 55–67 (2016)
Malik, S.I., Coldwell-Neilson, J.: A model for teaching an introductory programming course using ADRI. Educ. Inf. Technol. 22(3), 1089–1120 (2017)
Martin, J.: Introduction to Languages and the Theory of Computation. McGraw-Hill, New York (2003)
Mathrani, A., Christian, S., Ponder-Sutton, A.: PlayIT: game based learning approach for teaching programming concepts. Educ. Technol. Soc. 19(2), 5–17 (2016)
Miljanovic, M.A., Bradbury, J.S.: Robot ON!: a serious game for improving programming comprehension. In: GAS 2016, Proceedings of 5th International Workshop on Games and Software Engineeing, pp. 33–36. ACM (2016)
Özmen, B., Altun, A.: Undergraduate students’ experiences in programming: difficulties and obstacles. Turk. Online J. Qual. Inq. 5(3), 1–27 (2014)
Ramalingam, V., Wiedenbeck, S.: An empirical study of novice program comprehension in the imperative and object-oriented styles. In: Proceedings of 7th Workshop on Empirical Studies of Programmers, pp. 124–139. ACM (1997)
Sadigh, D., Seshia, S.A., Gupta, M.: Automating exercise generation: a step towards meeting the MOOC challenge for embedded systems. In: Proceedings of Workshop on Embedded and Cyber-Physical Systems Education, p. 2. ACM (2012)
Shargabi, A., Aljunid, S.A., Annamalai, M., Shuhidan, S.M., Zin, A.M.: Tasks that can improve novices’ program comprehension. In: Proceedings of IEEE Conference on e-Learning, e-Management and e-Services, pp. 32–37 (2015)
Sharples, M., et al.: Innovating Pedagogy 2016. Open University Innovation Report 5 (2016)
Siegfried, R.M., Siegfried, J., Alexandro, G.: A longitudinal analysis of the Reid list of first programming languages. Inf. Syst. Educ. J. 14(6), 47 (2016)
Singh, R., Gulwani, S., Rajamani, S.K.: Automatically generating algebra problems. In: AAAI 2012, Proceedings of 26th Conference on AI (2012)
Storey, M., Best, C., Michand, J.: SHriMP views: an interactive environment for exploring Java programs. In: Proceedings of 9th International Workshop on Program Comprehension, pp. 111–112. IEEE (2001)
Storey, M.A.: Theories, tools and research methods in program comprehension: past, present and future. Softw. Qual. J. 14(3), 187–208 (2006)
Wang, T., Su, X., Ma, P., Wang, Y., Wang, K.: Ability-training-oriented automated assessment in introductory programming course. Comput. Educ. 56(1), 220–226 (2011)
Yadin, A.: Reducing the dropout rate in an introductory programming course. ACM Inroads 2(4), 71–76 (2011)
Zhang, J., Atay, M., Caldwell, E.R., Jones, E.J.: Visualizing loops using a game-like instructional module. In: ICALT 2013, Proceedings of 13th IEEE International Conference on Advanced Learning Technology, pp. 448–450 (2013)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Ade-Ibijola, A. (2019). Syntactic Generation of Practice Novice Programs in Python. In: Kabanda, S., Suleman, H., Gruner, S. (eds) ICT Education. SACLA 2018. Communications in Computer and Information Science, vol 963. Springer, Cham. https://doi.org/10.1007/978-3-030-05813-5_11
Download citation
DOI: https://doi.org/10.1007/978-3-030-05813-5_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-05812-8
Online ISBN: 978-3-030-05813-5
eBook Packages: Computer ScienceComputer Science (R0)