location.ml 244 Bytes
Newer Older
1
2
3
4
type loc = int * int
exception Location of loc * exn

let noloc = (-1,-1)
5
6
7
8
9
10
11
12

type 'a located = { loc : loc; descr : 'a }

type expr = A | B of expr located

let rec recurs f x = f (recurs f) x.loc x.descr

let mk loc x = { loc = loc; descr = x }