C/Templates used by Alice

In this appendix, we list the various templates issued by Alice. The templates are laid out when the appropriate keywords or operators are recognized.


  Comment
{Comment}

  Program
program program-name(input,output);
{Comment that says what the routine does}
Declarations
begin
Statement
end.

  Label Declaration
label Label;

  Type Declaration
type
    Name = Type; {Comment}

  Const Declaration
const
    Name = Constant; {Comment}

  Var Declaration
var
    Name : Type; {Comment}

  Procedure Declaration
procedure proc-name(Parameter);
    {Comment that says what the routine does}
    Declarations
begin
    Statement
end;

  Function Declaration
function func-name(Parameter) : Type-Name;
    {Comment that says what the routine does}
    Declarations
begin
    Statement
end;

  Enumerated Types
Name = (Name);

  Subrange
lower-bound .. upper-bound

  Packed
packed Structured-Type

  Array
array [range] of Type

  Set
set of Simple-Type

  File
file of file-element-type

  Pointer
^Type-Name

  Record
record
Field-Declaration;
end;

  Field-Declaration
field-name : Type

  Variant Parts Of Records
case tag-name : tag-type of
Variant
end;

  Value Parameter
parm-name : Type-Name

  Var Parameter
var parm-name : Type-Name

  Formal Function
function func-name(Parameter) : Type;

  Formal Procedure
procedure proc-name(Parameter);

  Label
Label-Number :

  Goto
goto label;

  Procedure Call
Procedure Name(Value);

  Function Call
Function Name(Value)

  Assignment
Variable := Value;

  If
if Condition then begin
    Statement
    end;

  If-Else
if Condition then begin
    Statement
    end
 else begin
    Statement
    end;

  For
for variable := start to finish do begin
    Statement
    end;

  Downto
for variable := start downto finish do begin
    Statement
    end;

  While
while Condition do begin
    Statement
    end;

  Repeat
repeat
    Statement
until Condition;

  With
with record-variable do begin
    Statement
    end;

  Case
case Value of
    Case-Instance
    end;

  Begin
begin
    Statement
    end;

  Case Instance
Constant : begin
    Statement
    end;

  Else Case
else begin
    Statement
    end;

  Var Array
Variable[Subscript]

  Var Pointer
Variable^

  Var Field
Variable.Field

The templates that follow are all used for expressions. The format depends on the first character (operator) that is typed in.


  (
(Value)

  [
[Value]

  Not
not Value

  Unary Plus
+Value

  +
Value + Value

  -
Value - Value

  Or
Value or Value

  *
Value * Value

  /
Value / Value

  Div
Value div Value

  Mod
Value mod Value

  And
Value and Value

  =
Value = Value

  <>
Value <> Value

  <
Value < Value

  >
Value > Value

  >=
Value >= Value

  <=
Value <= Value

  In
Value in Value

  Subrange
Value .. Value