Abstract

The semantic denitions of compound Python programming language operators, for which we have expanding applications in application projects, are explained in the article. The denitions are written in the basic initial form, which is primary for the study of programming and for the construction of algorithms for data processing. On the basis of semantic denitions, syntax denitions are formed, which form the correct subset of the general Python syntax, and can be supplemented by extension operations without modication of the base part. The method of operational-functional denition of semantics is presented, which allows to rebuild syntax denitions so as to preserve the basic semantics of individual constructions of the language and to minimize the length of output by grammatical denitions startdef=>+"example". For this purpose we use basically three methods: reduction of complete grammatical rules; substitution of denitions of non-terminals on the right side of the syntax; adding non-strictly dened terminals with reference to previously dened non-terminals. Semantics models are built on the classication of operations and data conversion functions. Models are treated as universal algebras U(A) =< M;Ω >, where M is a nonempty set (quantities, memory cells, structures, operators), and Ω is a set of operations (possibly partial) on the set M, including the signature. We dene semantics models in two groups: 1)models based on valid Python operations; 2)models based on Python operators and control structures. For each group of models of algebra semantics has its own peculiarities. Semantics models are dened for the following objects: numeric types, assignment, data system, print, input; conditional expressions, conditional operator if; loop operators while, for; try exception control operator; operator with context managers.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call