Each concept of an algorithmic language implies a certain syntactic unit (construction) and the properties of program objects or data processing determined by it.
The concept of language is defined in the interaction of syntactic and semantic rules. The syntax rules show how this concept is formed from other concepts and letters of the alphabet, and semantic rules determine the properties of this concept.
The basic concepts in algorithmic languages are usually the following.
1. Names (identifiers) - are used to designate the objects of the program (variables, arrays, functions, etc.).
2. Operations . Types of operations:
- Arithmetic operations +, -, *, / and others. ;
- logical operations and, or, not ;
- operations of the relation <,>, <=,> =, =, <>;
- operation of the coupling (otherwise, "attachment", "concatenation") of the symbolic values of each other with the formation of one long string; depicted by the sign "+".
3. Data - values processed by the program . There are three main types of data: constants, variables and arrays .
- Constants are data that are fixed in the text of the program and do not change during its execution.
Examples of constants:
- numeric 7.5, 12;
- logical yes (true) , no (false);
- character (contain exactly one character) "A", "+";
- Letters (contain an arbitrary number of characters) "a0", "World", "" (empty line).
- Variables are denoted by names and can change their values during program execution. Variables can be integers, real, logical, symbolic and literal .
- Arrays are sequences of similar elements, the number of which is fixed and to which one name is assigned. The position of an element in an array is uniquely determined by its indices (one, in the case of a one-dimensional array, or several, if the array is multidimensional). Sometimes arrays are called tables.
4. Expressions — designed to perform the necessary calculations , consist of constants, variables, function pointers (for example, exp (x)), combined with operation signs.
Expressions are written in the form of linear sequences of characters (without subscripts and superscripts, "multi-level" fractions, etc.), which allows you to enter them into the computer by successively pressing the corresponding keyboard keys.
There are arithmetic, logical and string expressions .
- Arithmetic expressions are used to determine a single numeric value. For example, (1 + sin (x)) / 2. The value of this expression at x = 0 is 0.5, and at x = p / 2 - one.
- Logical expressions describe some conditions that may or may not be satisfied. Thus, a logical expression can take only two values - “true” or “ false” ( yes or no ). Consider as an example the logical expression x * x + y * y “true” , and for x = 2, y = 2, r = 1 - “false”.
- Linear (literal) expressions, the values of which are texts . The string expressions can include lettered and string constants, lettered and string variables, lettered functions separated by signs of a coupling operation. For example, A + B means appending the string B to the end of the string A. If A = "bush" and B = "green" , then the meaning of the expression A + B is "green bush".
5. Operators (commands). The operator is the largest and most meaningful concept of a language: each operator is a complete phrase of a language and defines some completely complete stage of data processing. The operators include:
- keywords;
- data;
- expressions, etc.
Operators are divided into executable and non-executable. Non-executable statements are designed to describe the data and structure of the program, and executable statements are used to perform various actions (for example, the assignment operator, input and output statements, conditional operator, cycle operators, procedure operator, etc.).
Comments
To leave a comment
Programming Languages and Methods / Translation Theory
Terms: Programming Languages and Methods / Translation Theory