10.07.2015 Views

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

Algol 68 - ACM Digital Library

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

170/van Wijngaarden, etal.ALGOL <strong>68</strong> Revised Report 171else undefined; cfi;set read mood (f)fi;op ! = (char s, c) char: string (s) ! c;proc skip initial spaces = void :while (k empty I next pos (f)); .9 ,.,, do skip od;proc skip spaces = void :while ? "." do skip od;proc read dig = string :(string t := "0123456789"! "0";while ? "0123456?89" do t plusab k od; t);proc read sign = char :(char t = (skip spaces; ? "+-"1 k I "+");skip spaces; t);proc read num = string :(char t = read sign; t + read dig);proc read real = string :(string t : = read sign;(" ? "."t t plusab read dig I k empty : = false);(.9 "."1 t plusab "." + read dig);(? "lo\e" l t plusab "1o" + read num); t);for) to upb ydo bool incomp : = false; k empty : = true;case y [j ] in~ (ref L int ii):(skip initial spaces;incomp := - string to Lint (read num, 10, ii))~ ,(ret L real rr):(skip initial spaces;incomp : = - string to L real (read real, rr)) 2 ,(ref L compl zz):(skip initial spaces;incomp := - string to L real (read real, re of zz);skip spaces; "i_L " ! ".L ";incomp : = incomp vstring to L real (read real, im of zz)) ~ ,(ref bool bb):(skip initial spaces;bb := (flip + flop) ! flop = flip),~ (ref L bits lb):for i to L bits widthdo get (f, (L F of lb) [ i]) od~ ,(ref char cc): (next pos (f); get char (f, cc)) ,(ref [ ] char ss):b)for i from Iwb ss to upb ssdo next pos (f); get char (f, ss [ i ]) od ,(ref string ss):begin string t;while check pos (f);if line ended (f) v logical file ended (f)then falseelse get char (f, k);k empty := - char in string (k, Ioc int, term off)fldo t plusab k od;SS :=tendesac;(- k empty l backspace (f));if incompthen (- (value error mended off) (f) I undefined);set read mood (f)fiodendesac odelse undefinedfl;proc .~ get char = (ref file f, ref char char) void :if opened off ^ - line ended (f) ^ - logical file ended (f)then ref pos cpos = cpos off;set char mood (f); set read mood (f);int p = p of cpos, l = l of cpos, c = c of cpos;c of cpos + : = 1;char : = case text of fin(lexttl): tl [p] [lJ [cJ,(flextext t2):(chark := t2 lP] Ill lcl;bool found : = false;for i to upb F of conv off while - founddo struct (char internal, external) key = (F of cony of f) [ i ];(external of key = k I k : = internal of key; found : = true)od;if found then kelse k := ". ";if(char error mended off) (f, k)then kelse undefined; "."fi;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!