A variable consists of | 1. Address
2. Type / Data type
3. Value
e.g int number = 1; |
What is a Literal? | A data value that appears in the program text without a variable
e.g A number 5 or 3.6,
or a text: "This is a text literal" |
What is a constant? | A variable whose content cannot be changed - e.g., pi for 3.141592653589793 |
In a high-level programming language, the instructions (statements, commands) are independent of the processor type. | Evaluation of expressions (calculations) and value assignment (e.g. x ← 10 * 6 + 7)
Command sequence*
Branching* (conditional statement, selection, choice) – two-way or multiway
Loop* (iteration, repetition) – head-controlled or foot-controlled
Subroutine call |
What are the types of branching? | Two-way branching
Selection of the next statement(s) based on a logical expression (e.g if else)
Multiway branching
Selection of the next statement(s) based on an expression with finite value range
(e.g switch case) |
What are the types of repititions? | Head-controlled loop
Repeat as long as a condition checked at the loop entry is fulfilled
(e.g while -> statement)
Foot-controlled loop
Repeat as long as a condition checked
at the loop exit is fulfilled
(e.g statement -> while) |
What are comments? | Comments are used to explain the program
Nesting of multiline comments is not allowed. |
Notation for production rules in EBNF | A ::= x y z concatenation xyz
A ::= x1|x2|...|xk alternative x1 or x2
A ::= x [y] z option xz or xyz
A ::= x {y} z repetition xz or xyz or xy or yz
A ::= x {y}+ z repetition y at least once (xz is forbidden)
A ::= (a | x) (b | z) bracketing of text parts ab or xb or az or xz |
Syntax of a name (identifier) in Java | Identifier ::= (Letter | SpecialSymol ) or { Letter | Digit | SpecialSymbol } |