DEFINITION MODULE PL0INT;

IMPORT FIO;

CONST
  maxLvl =   15;
  maxAdr = 1023;

TYPE
  TFunction = ( fLit, fOpr, fLod, fSto, fCal, fInt, fJmp, fJpc, fStp );
  TLevel    = [ 0 .. maxLvl ];
  TAddress  = [ 0 .. maxAdr ];
  TOperation = (
    opRet, opNeg, opAdd, opSub,
    opMul, opDiv, opOdd, opNop,
    opEql, opNeq, opLss, opGeq,
    opGtr, opLeq, opRed, opWrt
  );
  TValue = INTEGER;

  TInstruction = RECORD
    fct: TFunction;
    lvl: TLevel;
    CASE : CARDINAL OF
    | 0: adr: TAddress;
    | 1: opr: TOperation;
    | 2: val: TValue;
    END;
  END;

VAR
  code: ARRAY TAddress OF TInstruction;

PROCEDURE Run();

(* debugging *)
CONST
  out = FIO.StandardOutput;
  dbg = FIO.ErrorOutput;
PROCEDURE List( f: FIO.File );
PROCEDURE WrIns( f: FIO.File; ip: TAddress );

END PL0INT.
