Instructions for Translation from Pascal to Ada. by Paul Stachour 28 january 1999 -- v1.3 1. The Job: You are a Pascal Programmer. You are going to write some programs in Ada. You want to know about the mappings from Pascal to Ada. Or perhpas you wish to translate programs from Kruze's data structures book from Pascal to Ada. 2. Translations are to be done from the examples and the following rules: Pascal Ada Comments { text } -- text Strings ' ' " " units uses with, use iodefn use utility; with text_io; use text_io; lineio writeln put_line chario write put types type (once) type (each type defn) vars var nothing, uses ":" for defn. params var, val in out, in, out ranges (nothing) range stmt ends ";" as separator ";" as terminator if ends (nothing) end if; for loop for I = 1 to Limit do for I in 1 .. Limit loop loop ends (nothing) end loop; pgm ends end. end ; array mrk [] () not-equal <> /= loop exit do ... until () loop ... exit when () end loop; iomain required (nothing) constant const constant chars char character File posn main is first main is last keywords entry loop etc need a new name, like "item" with X do with X do ... top count loop S.top S.cout ... end loop function function Name (..) : type; function Name (..) return type is fctn ret FunctionName := ,expr>; return ; Pointers ^ access sub term var b: boolean); b: out boolean) is ... 3. Compiling and linking 3a) On a w3.1 machine, use gcc -c foo.adb gnatbl foo.ali 3b) On a w95/w98/Wnt machine, use Gnat Ada IDE Run| compile Run| link Run| build (when window has main program only) 4. Running 4a) on a w3.1 machine, just type the name of the program, like ch7_ts 4b) On a w95/w98/Wnt machine, use Gnat Ada IDE Run| execute run| Run captured