| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- program t42;
- (* Multi-name declarations, in both spellings TP3 accepts.
- TP3's grammar (TPSRC7) collects a comma-separated list of NAMES, then reads
- ONE `: type' for the whole list (rdvarlst/rdvloop for VAR, prfcnt/ccomma for
- parameters), and separates parameter groups with ';'. So all three of
- var a, b, c : integer ; (names joined by ',')
- procedure p (x, y : integer) (names joined by ',')
- procedure q (x : integer ; y : integer) (groups joined by ';')
- are legal, and this fixture uses each. The older `name : type, name : type'
- spelling is exercised too, so it keeps working. Every variable and every
- parameter must still land on the same slot layout as if written one per
- line, which is what the printed values check. *)
- var
- a, b, c : integer ;
- d : integer ;
- procedure add3 (x, y, z : integer) ;
- begin
- d := x + y + z
- end ;
- procedure add2 (p : integer, q : integer) ;
- begin
- d := d + p + q
- end ;
- procedure mix (u, v : integer ; w : integer) ;
- begin
- d := u * 100 + v * 10 + w
- end ;
- begin
- a := 1 ;
- b := 2 ;
- c := 3 ;
- add3 (a, b, c) ;
- writeln (d) ;
- d := 0 ;
- add2 (4, 5) ;
- writeln (d) ;
- writeln (a, ' ', b, ' ', c) ;
- mix (1, 2, 3) ;
- writeln (d)
- end.
|