1(* The intermediate language: extended lambda-calculus in de
2    Bruijn's notation *)
3
4local
5  open Const Prim;
6in
7
8datatype Lambda =
9    Lvar of int
10  | Lconst of StructConstant
11  | Lapply of Lambda * Lambda list
12  | Lfn of Lambda
13  | Llet of Lambda list * Lambda
14  | Lletrec of Lambda list * Lambda
15  | Lprim of primitive * Lambda list
16  | Lcase of Lambda * (SCon * Lambda) list
17  | Lswitch of int * Lambda * (BlockTag * Lambda) list
18  | Lstaticfail
19  | Lstatichandle of Lambda * Lambda
20  | Lhandle of Lambda * Lambda
21  | Lif of Lambda * Lambda * Lambda
22  | Lseq of Lambda * Lambda
23  | Lwhile of Lambda * Lambda
24  | Landalso of Lambda * Lambda
25  | Lorelse of Lambda * Lambda
26  | Lunspec
27  | Lshared of Lambda ref * int ref
28  | Lassign of int * Lambda
29;
30
31fun shared_lambda lam =
32  Lshared( ref lam, ref Instruct.Nolabel )
33;
34
35
36fun Lstruct [] = Lconst(BLOCKsc(CONtag(0,1),[]))
37|   Lstruct lams = Lprim(Pmakeblock(CONtag(0,1)), lams)
38
39end;
40