MSH interpreter implementation

MSH interpreter implementation. I want to introduce to the esteemed public the interpreter of the new programming language MSH. I already wrote articles about him on Habr. The last one is the MSH Interpreter . This article has links to previous articles on this topic.



Actually, the local public is rather skeptical about such creativity. But this is unfair. A successful programming language can significantly advance the entire IT industry. Reducing the development effort. I took up the development of my language not to satisfy my own ambitions. I believe that there is no successful programming language. And it is extremely necessary. Moreover, there is no language, but there is an ideology of language. This ideology is contained in the MUMPS language. But as a programming language it is not. It is used only as a database language and this significantly limits the scope of its application. This situation, in my opinion, has developed due to the self-interest of database developers and the lack of understanding of the potential of this language by everyone else. MUMPS now exists as a 1995 standard. Of course, in this form it has long been outdated. New programming concepts have appeared that must have a modern language. I undertook to develop such a language. In this case, it was necessary to maintain the ideology of MUMPS. And the ideology is the unity of code and data. The language is based not just on data, but on the data structure. And this is a fairly powerful structure. This is a tree. All other structures are modeled on a tree basis. In a degenerate case, a tree may consist of one vertex. In fact, the line between code and data is rather ephemeral. L



The program logic can be placed both in the code and in the data. And where to draw the line between code and data depends on the programmer. I tried to put all the program logic in the data. And the program simply went around the data tree and executed the commands there. The code, of course, has not gone away, but the structure of the program was outside the main program. The flexibility of such a program was high, but to understand such a program was simply impossible. So code and data make up unity. Moreover, the data structure is primary in relation to the content of the data. Separation into a programming language and a database is not natural.



When designing information systems, programs primarily manipulate data structures rather than content. The content becomes significant only at the time of arithmetic operations. The secondary nature of the content suggests that there is no need for data types. Data types are generated by computer architecture and the imperfection of translators. Data types have nothing to do with the meaningful meaning of information systems. It is clear that this simplifies compilers and IDEs, but all this is secondary. The problems that generate data types far outweigh the benefits that they provide. This does not mean that you do not need to control the content of the data. But this should be done only at the time of receipt of data from the outside. And the variable types do not give help in this. The variety of data content far exceeds the basic types of programming languages. It can be not only numbers, but also strings of various types. And numbers can have various restrictions. In any case, it is necessary to check the input data for correctness. So basic types have very little relation to data content.



Modern language should support OOP. Due to the lack of a declarative part in the language, I had to restrict myself to only part of the implementation of the class description. But the language does not impose a programming style. Do you want to use objects, do not want do not use. Event handling is widely used in Assembler. DOS was all built on event handling. In high-level languages, I do not know cases of using this technique. Although she has a high potential. The absence of an event processing language forces the programs to use various message processing cycles. A rather clumsy solution that causes a lot of problems when trying to perform some kind of processing inside the loop. Parallel processing of tasks is already used everywhere, but in many languages ​​it is not supported at the language level. This makes programs dependent on the OS and its version. The losses from such a decision are obvious in my opinion.



This is the ideology on which the MSH language is built.



  1. The unity of code and data structures, which means that the language has a powerful data structure.
  2. The lack of data types and, as a consequence, their declaration.
  3. Incorporation of modern programming techniques into the language. In MSH, these are objects, event handling, and parallel execution of tasks.


Whoever is interested in this language can get acquainted with it on github .



There are laid out the source code and a working example. Work on the language has just begun and this is not a finished product. But I think you can get an idea of ​​the language. The language was developed in Linux x64.



All Articles