DEFINITION MODULE PL0GEN;

FROM PL0INT IMPORT TFunction, TLevel, TAddress, TOperation, TValue;

PROCEDURE Label(): TAddress;                 (* label of next instruction *)
PROCEDURE Gen( f, l: CARDINAL; a: INTEGER ); (* generate instruction *)
PROCEDURE Fixup( a: TAddress );              (* fixup code[x] *)
PROCEDURE Init();
PROCEDURE End();

(* convenient add-ons *)

PROCEDURE List();

(* more convenient Gen procs *)

PROCEDURE Lit( v: TValue );
PROCEDURE Opr( o: TOperation );
PROCEDURE Lod( l: TLevel; a: TAddress );
PROCEDURE Sto( l: TLevel; a: TAddress );
PROCEDURE Cal( l: TLevel; a: TAddress );
PROCEDURE Int( da: TAddress );
PROCEDURE Jmp( a: TAddress );
PROCEDURE Jpc( a: TAddress );
PROCEDURE Stp();

(* most convenient Gen procs *)

PROCEDURE Put( v: TValue );
PROCEDURE Read();
PROCEDURE Write();

PROCEDURE Nop();
PROCEDURE Neg();
PROCEDURE Odd();

PROCEDURE Add();
PROCEDURE Sub();
PROCEDURE Mul();
PROCEDURE Div();

PROCEDURE Eql();
PROCEDURE Neq();
PROCEDURE Lss();
PROCEDURE Leq();
PROCEDURE Gtr();
PROCEDURE Geq();

PROCEDURE Load( l: TLevel; a: TAddress );
PROCEDURE Store( l: TLevel; a: TAddress );

PROCEDURE Enter( da: TAddress );
PROCEDURE Leave();

PROCEDURE JmpZ( a: TAddress );

PROCEDURE JmpFwd( VAR a: TAddress );
PROCEDURE JmpZFwd( VAR a: TAddress );

PROCEDURE Call( l: TLevel; a: TAddress );

PROCEDURE Stop();

END PL0GEN.
