'begin' 'comment' various examples from the RRA60 are here accumulated. this is only usefule to check the scanner. ; 'begin' 'comment' Example 2.4.2: Identifiers ; 'integer' q, Soup, V17a, a34kTMNs, MARILYN ; 'end'; 'begin' 'comment' Example 2.5.2: Numbers ; 'real' q ; q := 0 ; q := -200.084 ; q := -.083'10'-02 ; q := 177 ; q := + 07.43'10'8 ; q := -'10'7 ; q := .5384 ; q := 9.34'10'+10 ; q := '10'-4 ; q := +0.7300 ; q := 2'10'-4 ; q := +'10'+5 ; 'end'; 'begin' 'comment' Example 2.6.2: Strings ; 'procedure' foo (str); ; foo ( `5k,,-`[[[`'and'=/:Tt' ) ; foo ( `This_is_a_`string'' ) ; 'end'; 'begin' 'comment' Example 3.1.2: Variables ; 'integer' n ; 'real' pi ; 'array' Q2 [3:3, 1:1, 4:4] ; n := 1 ; pi := 3.1 ; Q2 [3,1,4] := 1 ; 'begin' 'integer' epsilon ; 'integer' detA ; 'integer' a17 ; 'array' Q[7:7,2:2] ; 'array' x[1:sin(n*pi/2),1:Q2[3,n,4]] ; 'end'; 'end'; 'begin' 'comment' Example 3.2.2: Function designators ; 'integer' a, b, n, c ; 'real' v, s, Q, P, T ; 'procedure' J (a, b); ; 'procedure' R; ; 'procedure' S (a, b, c); ; 'procedure' Compile (a, b); ; a := b := n := c := 1 ; v := s := Q := P := T := 2 ; 'begin' sin(a-b) ; J(v+s,n) ; R ; S(s-5) Temperature: (T) Pressure: (P) ; Compile (`:=') Stack: (Q) ; 'end'; 'end'; 'begin' 'comment' Example 3.3.2: Arithmetic expressions ; 'integer' A, B, N, b, k, n, i, U; 'real' Cu, Q, S, V, X, Yu, Z, sum, a, q, t, u, y, z, vu, omega, w1 ; 'boolean' q1 ; 'array' w [1:1, 8:8], a1 [0:0, 0:0] ; 'real' 'procedure' Q1 (x) ; Q1 := 2; A := B := U := b := k := n := N := 1 ; i := -1 ; Cu := S := Q := Yu := sum := y := z := a := vu := omega := 2 ; w1 := q := Z := t := u := V := 1 ; a1 [0, 0] := 2 ; q1 := 'true' ; w [1, 8] := 0.001; 'comment' Primaries ; X := 7.394'10'-8 ; X := sum ; X := w[i+2,8] ; X := cos(y+z*3) ; X := (a-3/y+vu^8) ; 'comment' Factors ; X := omega ; X := sum^cos(y+z*3) ; X := 7.394'10'-8^w[i+2,8]^(a-3/y+vu^8) ; 'comment' Terms ; X := U ; X := omega*sum^cos(y+z*3)/7.394'10'-8^w[i+2,8]^(a-3/y+vu^8) ; 'comment' Simple arithmetic expressions ; X := U-Yu+omega*sum^cos(y+z*3)/7.394'10'-8^w[i+2,8]^ (a-3/y+vu^8) ; 'comment' Arithmetic expressions ; X := w1*u-Q1(S+Cu)^2 ; X := 'if' q>0 'then' S+3*Q/A 'else' 2*S+3*q ; X := 'if' a<0 'then' U+V 'else' 'if' a*b>17 'then' U/V 'else' 'if'k!=y 'then' V/U 'else' 0 ; X := a*sin(omega*t) ; X := 0.57'10'12*a1[N*(N-1)/2,0] ; X := (A*arctan(y)+Z)^(7+Q) ; X := 'if' q1 'then' n-1 'else' n ; X := 'if' a<0 'then' A/B 'else' 'if' b=0 'then' B/A 'else' z ; 'end'; 'begin' 'comment' Example 3.4.2: Boolean expressions ; 'Boolean' B; 'integer' x, Y, V, z, q, a, b, d, y, k, s, w, h, c ; 'Boolean' pb, qb, gb, ab, bb, cb, db, eb, fb ; x := Y := V := z := q := a := b := d := y := 2 ; s := w := h := c := k := 2 ; pb := qb := gb := ab := bb := cb := db := 'true' ; eb := fb := 'true' ; B := x = -2 ; B := Y > V 'or' z < q ; B := a+b > -5 'and' z-d > q^2 ; B := bb 'and' qb 'or' x != y ; B := gb 'equiv' 'not' ab 'and' bb 'and' 'not' cb 'or' db 'or' eb 'impl' 'not' fb ; B := 'if' k<1 'then' sq 'then' 'goto' STOP 'else' 'if' x>w-2 'then' 'goto' S; Aw: St: W:=x+bob 'end' ; STOP: S: ; 'comment' Block ; m := 1 ; Q: 'begin' 'integer' i, k; 'real' w; 'for' i:=1 'step' 1 'until' m 'do' 'for' k:=i+1 'step' 1 'until' m 'do' 'begin' w:=AA[i,k]; AA[i,k]:=AA[k,i]; AA[k,i]:=w 'end' for i and k 'end' block Q 'end'; 'end'; 'begin' 'comment' Example 3.5.2: Designational expressions ; 'end'; 'begin' 'comment' Example 3.5.2: Designational expressions ; 'end'; 'begin' 'comment' Example 3.5.2: Designational expressions ; 'end'; 'begin' 'comment' Example 3.5.2: Designational expressions ; 'end'; 'begin' 'comment' Example 3.5.2: Designational expressions ; 'end'; 'end'