Preview

Proceedings of the Southwest State University. Series: IT Management, Computer Science, Computer Engineering. Medical Equipment Engineering

Advanced search

Using Metaprogramming Tools of the Common Lisp Language for the Development of Emulator Systems

https://doi.org/10.21869/2223-1536-2023-13-3-135-145

Abstract

The purpose of research is to analyze and use metaprogramming in the Common Lisp language when designing and implementing emulators that simulate computer system hardware. The metaprogramming, the macro tools of the Common Lisp language and the use of macros for metaprogramming are considered.

Methods. The Lisp language is characterized by its use of uniform S-expressions to represent data and programs. Thus, data can be part of a program and vice versa: a program can be data. Common Lisp macro tools allow you to directly modify the abstract syntax tree of a program, and thus it is possible to create new syntactic constructs to solve a given problem. When implementing emulator functions, macro tools of the Common Lisp language can be used to generate functions, where the common part of the functions is included in the macro, and the differences between the functions are specified in the parameters when calling the macros. Examples of this macros are: bit status register macros, generation of ariphmetic commands, comparation commands, memory commands. Using that you can significantly reduce the size of the program.

Results. As a result of computer modeling, a simulator of the NES architecture (MOS 6502 processor) was developed and implemented in the conventional object-orientied C# programming language and in the Common Lisp metaprogramming language. As a result, the simulator written in a language with metaprogramming support turned out to be more than 2 times smaller than the simulator written in C#.

Conclusion. The use of metaprogramming (using the example of creating emulators) can significantly reduce the size of a program, simplify and improve the program architecture, reduce the number of errors and improve the quality of programs. The use of domain specific languages lets reduce code size even more.

About the Author

А. А. Chaplygin
Southwest State University
Russian Federation

Aleksandr А. Chaplygin, Cand. of Sci. (Engineering), Associate Professor of the Department of Software Engeneering

50 Let Oktyabrya Str. 94, Kursk 305040



References

1. Ingebrigtsen E. Metaprogramming in C#. Birmingham, UK, Packt Publishing Limited, 2023. 353 p.

2. Lotoreychik V. Y. Metaprogrammirovanie na osnove tekstovogo preprocessora [Metaprogramming based on word processor]. Nauchno-tekhnicheskij vestnik Sankt-Peterburgskogo gosudarstvennogo universiteta informacionnyh tekhnologij, mekhaniki i optiki = Scientific and Technical Journal of Information Technologies, Mechanics and Optics, 2006, no. 25, pp. 57–65. EDN JURWLF

3. What APIs Are and Why They Matter. Available at: https://www.f5.com/ labs/articles/education/still-mystified-by-apis-what-they-are-really-and-why-they-matter. (accessed 26.05.2022)

4. Anikin D. A. Analiz metodov avtorizacii i autentifikacii REST API [Analysis of REST API authorization and authentication methods REST API]. Mezhdunarodnyj Zhurnal Informacionnyh Tekhnologij i Energoeffektivnosti = International Journal of Information Technologies and Energy, 2023, vol. 8, no. 5-2(31), pp. 120–124. EDN DZKSMQ

5. Denisov D. Sravnenie Typescript i Javascript dlya web-razrabotki [Comparison of typescript and javascript for web development]. Studencheskij vestnik = Student Bulletin, 2023, no. 20-8(259), pp. 57–58. EDN MQCOML

6. Nazarova O. V. Interaktivnyj uchebnik po Java Script [Interactive JavaScript toolbook]. Hroniki ob"edinennogo fonda elektronnyh resursov. Nauka i obrazovanie = United Fond of Electronic Resources Chronicles: Science and Aducation, 2017, no. 7(98), p. 63. EDN ZRRDGB

7. Skott Adam D., Makdonald M., Pauers Shelli. JavaScript. Recepty dlya razrabotchikov [JavaScript Cookbook: Programming the Web]. 3rd ed. St. Petersburg, Peter Publ., 2023. 528 p.

8. Abelson H., Sussman D. Struktura i interpretaciya komp'yuternyh programm [Structure and Interpretation of Computer Programs]. Moscow, Dobrosvet, KDU Publ., 2012. 608 p.

9. Evans E. Predmetno-orientirovannoe proektirovanie (DDD). Strukturizaciya slozhnyh programmnyh system [Subject-oriented design (Domain Driven Development). Structuring of complex software systems]. Moscow, Villiams Publ., 2020. 448 p.

10. Suhov A. O. [Classifiaction of domain specific languages and meanings]. Matematika programmnyh system. Mezhvuzovskij sbornik nauchnyh statej [Mathematics of software systems. Interuniversity collection of scientific articles]; ed. by A. I. Mikov and L. N. Lyadova. Perm, Perm State National Research University Publ., 2012, pp. 74–83. (In Russ.). EDN TOFMPJ

11. Fowler M. Domain Specific Language Available at: http://gnetna.com/books/Domain-Specific%20Languages.pdf. (accessed 25.05.2023)

12. Tihonov A. Y. Kombinirovannyj (staticheskij i dinamicheskij) analiz binarnogo koda [Combined static and dynamic binary code analisys]. Trudy Instituta sistemnogo programmirovaniya RAN = Issues of ISP RAN, 2012, vol. 22, pp. 131–152.

13. Davide Di Gennaro. Advanced Metaprogramming in Classic C++. Berkeley, CA, Apress, 2015. 572 p.

14. McCarthy John. Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I. Communications of the ACM, 1960, vol. 3, no. 4, pp. 184–195.

15. Domkin V. Programming Algorithms in Lisp. Berkeley, CA, Apress, 2021. 392 p.

16. Sosnovsky E. I. Ispol'zovanie yazyka programmirovaniya LISP dlya rasshireniya bazovyh vozmozhnostej byudzhetnyh SAPR [Using Lisp language for adjusting CAD base functions]. Novye komp'yuternye tekhnologii = New Computer Technologies, 2012, vol. 10, no. 1(10), pp. 55–59. EDN WHKGLD

17. Graham P. ANSI Common LISP. Philadelphia, USA, Pearson Publ., 1995. 448 p.

18. Raportirenko A. M. Common Lisp versiya sistemy komp'yuternoj algebry REDUCE [Common Lisp version of REDUCE computer algebra system]. Vestnik Rossijskogo universiteta druzhby narodov. Seriya: Matematika, informatika, fizika = Bulletin of Russian Peoples’ Friendship University. Series: Mathematics, Information Sciences and Physics, 2010, no. 2-2, pp. 40–44. EDN MQIMWJ

19. Sibel P. Prakticheskoe ispol'zovanie Common Lisp [Practical Common Lisp]. Moscow, DMK Press Publ., 2023. 488 p.

20. Treshchev I., Kozhin I. Emulyatory i simulyatory setej EVM. Dlya studentov tekhnicheskih special'nostej [Emulators and simulators of computer networks. For technical students]. Moscow, Ridero Publ., 2018. 166 p.


Review

For citations:


Chaplygin А.А. Using Metaprogramming Tools of the Common Lisp Language for the Development of Emulator Systems. Proceedings of the Southwest State University. Series: IT Management, Computer Science, Computer Engineering. Medical Equipment Engineering. 2023;13(3):135-145. (In Russ.) https://doi.org/10.21869/2223-1536-2023-13-3-135-145

Views: 179


Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.


ISSN 2223-1536 (Print)