summaryrefslogtreecommitdiff
path: root/tiger-compiler/tests/good/recursive-types.tig
blob: 60cc37869f265c2a6e3aac1bb48b0befe6636df7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* define valid recursive types */

let
  /* define a list */
  type intlist = {hd : int, tl : intlist}

  /* define a tree */
  type tree = {key : int, children : treelist}
  type treelist = {hd : tree, tl : treelist}

  var lis : intlist := intlist { hd = 0, tl = nil }

in
  lis
end