Sound programming language / Hebrew

Sound programming language / Hebrew

Means of processing unified data by purpose (Sound – system for operating with unified data) is developed for clear programming, which ensures that the results of calculations match the purpose. p align=”justify”> The purpose of the data is the formal specification of the computations leading to this data. The Sound programming language is needed as a universal tool that allows translation of computational logic in any programming language.

Expressive programming implies that the result of evaluating the expression will remain within the result type of the computation and conform to the formal specification. Thus, an expressive programming language should provide tools for direct or indirect specification input along with data correctness control.

The purpose of the data is its logical content, expressed as a logical formula, which means the content of the data. The Sound language allows you to indirectly express logical relationships between the assignments of the results of intermediate calculations. Although the specification is usually entered in comments to the program and is not expressed in the programming language, the language constructs should facilitate understanding of the internal logic of the calculations, so that the reader can, if possible, verify the correspondence of this logic to the desired result.

For example, the procedure for converting a number to an array of numbers consists of a looped block that accepts a number as input and returns its smallest digit, which is then stored in the next element of the sequence. In the language of Sound, it is expressed as follows:

from Compute where {DigitsRange=range(0), Sequence=Array<DigitsRange>, Number=Int} call NumberToDigits(100, 2)

module Compute:
    type Sequence, DigitsRange, Number
    func NumberToDigits (x: Number, base: Number) -> a: Sequence[DigitsRange] =
        if x < 0:
        k: DigitsRange = 0  # количество цифр
        y = x  # тип назначается автоматически
            next_digit(@y, base, @a, k) -> ok: Bool =
                digit = lowest_digit (y, base) -> d: Number = 
                    d = y % base    
                @a[k] = digit
                @y /= base
                ok = (y != 0)
            if ok:
                k += 1
        if k == 0:
            k = 1
            a[0] = 0

An important point in programming languages ​​are the names denoting certain concepts. There are three types of names in the Sound language: 1) names that directly denote data of one or another type; 2) names denoting specific types of data; 3) names denoting abstract data types.

In Sound, an abstract data type is a name that can be substituted for the name of any concrete data type that is not prohibited by the logic of the calculation.

An example of an abstract data type is an indexable container. Indexing is done using the “range” type. In the case of a fixed number of indices, they are enumerated with commas and enclosed in square brackets, in the case of a variable number of indices, the type “multidimensional range” is introduced, which is enclosed in double square brackets. As a range can be a type of container-specific index numbers. This means that a language may forbid indexing using the same range, say a numeric and a string sequence, because the meaning of the indexes may differ. This can be convenient in cases where you have to work with a lot of data at once, and each index variable means a reference to data of a certain type.

The unification of data assignment means that with each name that means data, the semantics of the data stored are defined. In the example of converting a number to a sequence of numbers, this semantics is expressed in a named block.

However, I would like to be able to express in language the logical relationships between the computational blocks, so that when reading the program it is possible to decide whether the logic of the calculations corresponds to the purpose. The unification language of data assignment includes the following elements:

  • external interfaces – data models

  • internal interfaces – data structures

  • destination – data semantics

In the considered example of data assignment, there is a repetition of the block with a transition from the state with the number k in a state with a number k+1.

Sound technology can be implemented in any programming language, so the Sound language can be translated by any software. According to the stored program principle, any program is data that can be processed by the translator. Therefore, in the example with numbers, the array is not initially declared, and the details related to memory allocation can be described outside the calculation module.

Related posts