Journal: IPSI Transactions on Internet Research


Metamodel-based Language Definition with Python

Authors: Sergej Chodarev and Sharoon Ilyas


View PDF Cite this article

Abstract

Most of the parser tools are concentrated on concrete syntax and grammar definition. This paper describes a language definition tool that uses a metamodel specification instead of grammar as the basis of the language definition. Inspired by a similar Java tool known as YAJCo, the metamodel is defined using usual object-oriented techniques—as classes in the Python programming language, and the result of the parsing process is a graph of objects. The tool is demonstrated in a case study of a simple imperative programming language. We explain our design decisions and also demonstrate the suitability of a dynamic language such, as Python, for this task.


Keywords

annotations, language definition, metamodel, parsing, Python, YAJCo


Published in: IPSI Transaction on Internet Research (Volume: 19, Issue: 1)
Publisher: IPSI, Belgrade

Date of Publication: January 1, 2023

Open Access: CC-BY-NC-ND
DOI: 10.58245/ipsi.tir.2301.06

Pages: 32 - 38

ISSN: 1820 - 4503



References

1. M. Mernik, J. Heering, and A. M. Sloane, “When and how to develop domain-specific languages,” ACM Computing Surveys, vol. 37, no. 4, pp. 316–344, Dec. 2005.

2. A. Kleppe, “A language description is more than a metamodel,” in Fourth International Workshop on Software Language Engineering, 2007. [Online]. Available: http://doc.utwente.nl/64546/

3. J. Poruban, M. Forg ¨ ac, M. Sabo, and M. B ´ eh ˇ alek, “Annotation based ´ parser generator,” Computer Science and Information Systems, vol. 7, no. 2, pp. 291–307, 2010.

4. S. Chodarev and S. Ilyas, “Metamodel-based parser generator for python,” in 2022 IEEE 16th International Scientific Conference on Informatics, 2022, pp. 126–131.

5. S. Chodarev and M. Bacˇ´ıkova, “Abstract-syntax-driven development ´ of oberon-0 using yajco,” Journal of information and organizational sciences, vol. 43, no. 2, pp. 145–162, 2019.

6. S. Chodarev, D. Lakatos, J. Porub ˇ an, and J. Koll ¨ ar, “Abstract syntax ´ driven approach for language composition,” Open Computer Science, vol. 4, no. 3, pp. 107–117, 2014.

7. G. van Rossum and Talin, “Introducing Abstract Base Classes,” PEP 3119, 2007. [Online]. Available: https://peps.python.org/pep-3119/

8. C. Winter and T. Lownds, “Function annotations,” PEP 3107, 2006. [Online]. Available: https://peps.python.org/pep-3107/

9. G. van Rossum, J. Lehtosalo, and Łukasz Langa, “Type hints,” PEP 484, 2014. [Online]. Available: https://peps.python.org/pep-0484/

10. R. Gonzalez, P. House, I. Levkivskyi, L. Roach, and G. van Rossum, “Syntax for variable annotations,” PEP 526, 2016. [Online]. Available: https://peps.python.org/pep-0526/

...

×

Sergej Chodarev

Department of Computers and Informatics, Technical University of Košice, Košice, Slovakia. E-mail: sergej.chodarev@tuke.sk; Orcid ID: 0000-0002-9293-0859

×

Sharoon Ilyas

Department of Computers and Informatics, Technical University of Košice, Košice, Slovakia. E-mail: sharoon.ilyas94@gmail.com

×

Cite this article

Chodarev, Sergej and Ilyas, Sharoon "Metamodel-based Language Definition with Python", IPSI Transactions on Internet Research, vol. 19(1), pp. 32-38, 2023. https://doi.org/10.58245/ipsi.tir.2301.06