Constants

a) An integer constant of any integer base from 2 to 36 may be specified. The form is base_constant where base is a decimal value and constant is an integer expressed with respect to the base. The letters A, B, ..., Y, Z are used to represent the digits 10, 11, ...., 34, 35 in the integer. Examples: 2_1010 ten in binary 8_12 ten in octal 16_A ten in hexadecimal
An alternative form is provided for binary, octal and hexadecimal constants: B'1010' ten in binary K'12' ten in octal X'A' ten in hexadecimal b) Variables of all types can be given the attribute %constant. This can be considered a special form of %own variable, which cannot be changed from its initial value. However it is probably better to consider such variables as "named constants", since 1) this accords with their intended use, i.e. for replacing arithmetic or string constants within code by meaningful names; and 2) they do not have addresses, unlike other variables (but like constants). Wherever a constant is permitted in an IMP80 program, a "constant expression" can be used instead. A constant expression is one which can be evaluated at compile-time, i.e. its operands are constants or named constants.
Example: %string(73) DELIVERY can be replaced by %constant %integer MAXNAME=20, MAXADDRESS=52 %string(MAXNAME+1{for the newline}+MAXADDRESS) DELIVERY Example: %constant %integer NO=0, YES=1, INPUT=1, CALCULATION=2, OUTPUT=3 %switch PHASE(INPUT:OUTPUT) : : ->PHASE(OUTPUT) %if DONE=YES : : PHASE(OUTPUT): ! Now print the results