📜 ⬆️ ⬇️

Basic concepts adopted in the Lada language

The language of the Lada system is object. It is not so much a language as a system of rules for creating, editing, storing, and the protocol for the exchange of objects that the languages ​​operating in the Lada system must follow. These rules are general and for creating text documents (in other languages), and for creating, storing and editing any data, and can also be a programming language. There are means of an imperative representation of an object (with properties, methods, and events), elements of functional programming, and a logical representation of an object (representation in the form of an utterance). Implemented the same automatic paradigm. In addition, an attempt was made to universalize the syntax of object definitions. And the point is not in the desire of the author to do something original, but on the contrary lead to a single mind. Three concepts have been developed for this. Namely:

1. Rules for naming objects.
2. Rules for grouping objects. Combining objects.
3. The principle of nesting objects.
4. Rules for creating objects.
5. Rules for the implementation of an object (Assigning property values, adding new properties, methods and events).

The following substantiates the need for these concepts in OOP, which are described in detail in the relevant sections of the document.
There should be no questions about the need for naming objects. With the help of names we have the ability to identify the object. The rules for naming objects consist of two parts of the rule for naming an object and the rule for using a name as a tool to access an object. Usually the name of the object is unique in some area. In the Lada system, the uniqueness of the name is not always required (Section 1).
The concept of a group is fundamental to the Lada machine, primarily because it performs not only objects, but also groups of objects. For example, in the addition operation (as in any other) in the Lada machine, not two operators participate, as usual, but a group of operands, which follow the grouping rules. (Section 2).
Each object can have nested objects. In the case of the addition operation, the nested objects are operands. The form may contain controls. Operators can have nested operators that are the body of an operator. For the Lada system, the principle of nesting is one of the main principles and is therefore part of the syntax of the defining object.
When creating an object, you must define:
1. The class of the object. Required.
2. The name of the object. Not necessary.
3. Assign values ​​to properties, add new properties (different from those defined in the class), methods and events.
4. Add nested objects.

The class and name of an object is defined by the following syntax:

Object = "Class Name" "Object Name"

The assignment of values ​​to properties, methods and events are carried out by operators, following in brackets after the object definition. The use of brackets (grouping objects) for this purpose is called implementation and is carried out according to the rules of grouping and the rules of implementation. (Section 3).

This is how objects are created using syntax. And it is quite obvious that the objects created by the syntax will appear after the translation. But, objects can be created and dragging them from the toolbar or typing letters from the keyboard. Letters are also objects. Those. creating and editing a document, we deal with objects. Objects created in this way have a graphic image, therefore we will call them objects-signs. Changing the values ​​of properties of such objects is usually done using the object properties panel (or by calling the “properties” item in the context menu of the right-clicked menu), which is based on the class description. But the system has the ability to assign values, add nested objects or extend the capabilities of an object with new properties, methods and events, as well as add nested objects to an object. This feature is called the implementation of sign objects. (Section 3).
It is clear that the objects are signs and are the contents of the document. This document in this form could be stored. However, there is another class of objects that is created at the stage of lexical analysis. These are value objects. By value objects we call objects generated by the Type class and having a numeric or textual representation. For example, "21", "100kg" or "October 1, 1995". And if the language in which we work has a vocabulary, then the lexical parsing happens automatically as soon as the document is typed, and this lexical analysis creates value objects.
So, the first method to create an object is to create letters (characters), tokens, and values. Sign objects are usually created by typing on the keyboard. Lexeme objects and values ​​arise from a group of characters as a result of lexical analysis. Let us explain this with an example. So the following text
For I = 30 To N {J +: = 1}
as a result of lexical analysis, it is divided into lexemes “For”, “I”, “=”, “30”, “To”, etc. In this sense, "For", "I" and "To" objects are tokens of the class "Word". So, we see that the object “I” can be considered as a letter object and as a token of the Word class. It is these objects (obtained as a result of lexical analysis) that will be submitted as an input chain to the parser (and further to the semantic one). As a result of the work of the parser, a For class object with the name I will be created from the sequence of tokens, which in turn may need to be implemented. Separately dwell on the objects values. In our example, as a result of lexical analysis, an object of class Integer and a value of 30 will be created with the value 30. This is the object-value. By value objects we call objects generated by the Type class and having a numeric or textual representation. For example, "21", "100kg" or "October 1, 1995".
And the last option to create objects when translating according to the rules of syntactic analysis. For example, from such syntactic construction Integer I = 30 as a result of translation, an object of class Integer with value 30 and named I. will be obtained as well.
So, we have hierarchy of objects. First, the sign objects, then the token objects and the next level are the objects that are obtained as a result of translation when analyzing the syntax. All these objects are static, i.e. in the body of the document. Using the implementation, you can change the properties and fill the object with functional content. Due to the fact that the change of properties and the implementation of the functional must be performed at different stages and there are several types of implementation. So the implementation of the objects of signs, lexemes and values ​​occurs at the stage of lexical analysis and is defined by brackets (lexical brackets) "" "" '". The implementation of the sign object immediately follows this sign without a space. The implementation of tokens and values ​​is separated by a space after the object to be implemented. And performed during lexical analysis. The implementation of the objects created by the syntax is subject to the rules of grouping, i.e. curly, round or square brackets. Properties are assigned at the broadcast stage, and the functional part is executed when the translated program is started. In addition, each object may contain a logical implementation, which is carried out by brackets (logical brackets) "‹ "and" ›". And finally, the implementation of the names is carried out by brackets ““ ”and“ ””. The meaning of implementing names is that an object or a group of objects (for example, functions or concepts) can be called by name and executed (possibly with parameters), but after the object is executed, some other actions may be necessary. This implementation will be called implementation of names or metarealization. Section 3.
And there is another fourth way to create objects dynamically, at runtime. Dynamic objects are created by the operators Dim, New and Var as a result of execution, by applying these operators to the object.

Source: https://habr.com/ru/post/100675/

All Articles