Chapter 1

[*]Ex 1.1

(a)
Yes, it contains lower-case letters.
(b)
Yes, it starts with a digit.
(c)
No.
(d)
Yes, a space is included.
(e)
Yes, a full stop is included.
[*]Ex 1.2
It starts with a capital letter and continues with capital letters, digits or underscores with no intervening spaces, tab characters or newline characters.

[*]Ex 1.3
33
[*]Ex 1.4

(a)
It contains commas.
(b)
It contains a decimal point.
(c)
It is not a denotation: it is a formula (see chapter 2).

[*]Ex 1.5

(a)
It is not an identifier: it is a mode-indicant.
(b)
Nothing--it's all right.
(c)
It contains a minus symbol.
(d)
It contains upper-case letters.
[*]Ex 1.6

(a)
The > symbol should be =.
(b)
The integer denotation is larger than the largest integer that the compiler can handle.
[*]Ex 1.7
INT max int = 2 147 483 647

[*]Ex 1.8
"." "," "8"
[*]Ex 1.9
CHAR question mark = "?"

[*]Ex 1.10
The 5. should be 5.0. Either the semicolon should be replaced by a comma, or z should be preceded by REAL or INT.
[*]Ex 1.11
REAL light year = 9.454 26 e15
(assuming 365 days per year).

[*]Ex 1.12
The print phrase has one opening parenthesis and two closing ones and there is no CONTEXT VOID USE standard preceding the BEGIN.
[*]Ex 1.13
The first displays 20 at the start of the line. The second displays +20 +48930767 on one line.

[*]Ex 1.14
It should display your name without quote symbols on the screen. Here is an example program:-
   PROGRAM ex1 14 CONTEXT VOID
   USE standard
   BEGIN
      CHAR s="S", i="i", a="a", n="n";
      CO Letters of my first name CO
      print(s); print(i);
      print(a); print(n)
   END
   FINISH
which will display Sian on the screen.

[*]Ex 1.15

(a)
1996
(b)
"e"
(c)
0.142857
[*]Ex 1.16

(a)
Yes, it contains spaces.
(b)
Yes, it contains a decimal point.
(c)
No.
(d)
Yes, it starts with a digit.
[*]Ex 1.17

(a)
INT fifty five = 55
(b)
REAL three times two point seven = 8.1
(c)
CHAR colon=":"
[*]Ex 1.18
Yes, you cannot guarantee that the declaration for x will be elaborated before the declaration of y. The declarations should be written
   REAL x = 1.234;
   REAL y = x
[*]Ex 1.19
0 denotes an integer with mode INT, 0.0 denotes a real number with mode REAL.
[*]Ex 1.20
   PROGRAM ex1 20 CONTEXT VOID
   USE standard
   BEGIN
      print(0.5);  print(blank);
      print("G");  print(1);
      print(blank);print(":");
      print(34 000 000)
   END
   FINISH

Sian Mountbatten 2012-01-19