In this paper, two approaches are used to construct the dynamic semantics of computer programs: the first is the representation of mathematical models of computational processes generated by a computer program in the form of a discrete transformer; the second is the representation of the mathematical model of a computer program in terms of functional grammars. The study focuses on the computational process generated by a computer program. Application of the discrete transducers concept to describe computational processes allows us to obtain a mathematical model or dynamic semantics of a program, which is a composition of two discrete systems B and C. In this case, component A is a control component (a model of the program block diagram), and component B is a model of the program memory. The decomposition of a program into two components B and B is convenient when studying the process of modelling a computational process. This is due to the fact that the prospects of searching for invariants in critical nodes of a programme for mathematical proof of correctness of a computer programme are opened. The comparative analysis of the two approaches leads to the theorem on the regularity of the representation of a function generated by a programme within the framework of functional grammar.