Test1.pss program runerror(output); var i: integer; b: boolean; x: real; function f(m,n: integer): integer; begin f := f(n, m mod n) end; begin x := 9.87654321; b := true; i := f(511,31) end. Test2.pss program syntaxerror(output); const m = 10, n := 20 type t = array 1..10 of real; r := record x: real, b,c : boolean end var i: integer; p,q: boolean; x,y: real;; i: integer, ch: char a: array (1..m) of integer; const y = 3.14159; begin i := x m := i if b do p = (p or q; while j < 10 begin k := .5+(x-y; y := x) end if p then p = 1; else i := 2; repeat x := p + i*(x>y); for x = 1 to q begin i := a[2 until i=j for j := 1 to n while x > 0 do begin a(j] := a[j+1); read(i) end . Test3.pss program test0(output); const ten = 10; plus = 't'; type row = array [1..ten] of real; complex = record re,im: real end ; var i,j: integer; p: boolean; z: complex; matrix: array[-3..+3] of row; pattern: array [1..5, 1..5] of char; procedure dummy(var i: integer; var z: complex); var u,v: row; h1,h2: record c: complex; r: row end ; function null(x,y: real; z: complex): boolean; var a: array['a'..'z'] of complex; u: char; begin while x j then i := i-j else j := j-i until i = j ; writeln(i) end. Test4.pss program test(input,output); var i,j,max:integer; function prime(i:integer):boolean; var j:integer; bool:boolean; begin j:=2; bool:=true; while ((j*j<=i) and bool) do begin bool:=((i mod j)<>0); 7j:=j+1; end; prime:=bool; end; begin write('max ? '); readln(max); j:=0; for i:=1 to max do if prime(i) then begin j:=j+1 end; writeln; writeln('Between 1 and ',max,' is there ',j,' primes'); end. Test5.pss (*pascal teaser, access of components, bl 750807*) program tease1 (output); var v: char; r: record f: record f: char end; g: record f: char end; end; a: array [char] of char; begin (*tease*) v.t := r [ v ]; a.f := v ; a [ r . f . f] := r . g . g; a [ r ] . f := r . 1 ; a ( 1 ) := r ; a [ '1', '1' ] := v; end. Test6.pss program roman (output); var i : integer; procedure romanout(i: integer); (* prints roman representation of i *) var pos: integer; scale: array [1..7] of record amount: integer; sign : char end; begin (*romanout*) scale[1]. amount := 1; scale[1]. sign := 'I'; scale[2]. amount := 5; scale[2]. sign := 'V'; scale[3]. amount :=10; scale[3]. sign := 'X'; scale[4]. amount :=50; scale[4]. sign := 'L'; scale[5]. amount:=100; scale[5]. sign := 'C'; scale[6]. amount:=500; scale[6]. sign := 'D'; scale[7]. amount:=1000;scale[7]. sign := 'M'; write(' '); for pos := 7 downto 1 do while i>= scale[pos].amount do begin i:= i- scale[pos].amount; write(scale[pos].sign) end; end (*romanout*); begin (*main program*) i:= 1; while i<= 5000 do begin write(i);romanout(i);writeln; i:= i*2 end end (*roman*). Test7.pss (*program 11.4 (*conversion to postfix form *) program postfix(input,output); var ch: char; procedure find; (* finds next non-blank character*) begin repeat read(ch) until (ch<>' ') (*-and not eoln(input)-*) end (* find *); procedure expression; var op: char; procedure term; procedure factor; begin (*factor*) if ch='(' then (* (expression) *) begin find; expression; (*ch must now be ) *) end else (*identifier*) write(ch); find end (*factor*); begin (* term*) factor; while ch= '*' do begin find; factor; write('*') end end (*term*); begin (*expression*) term; while (ch='+') or (ch='-') do begin op:= ch; find; term; write(op) end; end (*expression*); begin (*postfix*) find; repeat write(' '); expression; writeln until ch= '.' end (*postfix*). Data7 ( a + b ) * ( c - d ) a + b * c - d (a + b) * c - d a*a*a*a b+c*(d+c*a*a)*b+a . Test8.pss program roman (output); var a: array[1..100] of integer; i: integer; begin (*main program*) for i:=1 to 100 do a[i]:= 2 * i; for i:=1 to 30 do writeln(a[3*i]); end (*roman*).