package lrgrep

  1. Overview
  2. Docs
Analyse the stack of a Menhir-generated LR parser using regular expressions

Install

dune-project
 Dependency

Authors

Maintainers

Sources

lrgrep-0.3.tbz
sha256=84a1874d0c063da371e19c84243aac7c40bfcb9aaf204251e0eb0d1f077f2cde
sha512=5a16ff42a196fd741bc64a1bdd45b4dca0098633e73aa665829a44625ec15382891c3643fa210dbe3704336eab095d4024e093e37ae5313810f6754de6119d55

doc/src/utils/indexSet.ml.html

Source file indexSet.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
open Fix.Indexing

module FSet (X : Index.Unsafe.T) = struct
  module type S = sig
    include SetSig.S1 with type 'a t = IntSet.t
                       and type 'a element = 'a X.t

    val unsafe_to_indexset : 'a t -> 'b t
    val unsafe_of_intset : IntSet.t -> 'a t
  end
end

module FIntSet : FSet(Index.Unsafe.Int).S =
struct
  type _element = int
  type _t = IntSet.t

  type 'a element = _element
  type 'a t = _t

  include (IntSet : SetSig.S0 with type element := _element and type t := _t)

  let unsafe_to_indexset x = x
  let unsafe_of_intset x = x
end

module IndexSet = Index.Unsafe.Coerce(FSet)(FIntSet)

include IndexSet

module CoerceSum(X : CARDINAL)(Y : CARDINAL) = struct
  let coerce : X.n t -> (X.n, Y.n) Sum.n t = unsafe_to_indexset
end

let all n =
  let i = Fix.Indexing.cardinal n in
  if i = 0 then
    empty
  else
    let a = Index.of_int n 0 in
    let b = Index.of_int n (i - 1) in
    init_interval a b

let init_from_set c f =
  match Fix.Indexing.cardinal c with
  | 0 -> empty
  | n -> init_subset (Index.of_int c 0) (Index.of_int c (n - 1)) f


module FSetSet (X : Index.Unsafe.T) = struct
  module type S = sig
    include SetSig.StdSetS1 with type 'a t = IntSetSet.t
                             and type 'a elt = 'a X.t IndexSet.t
  end
end

module FIntSetSet : FSetSet(Index.Unsafe.Int).S =
struct
  type _elt = IntSet.t
  type _t = IntSetSet.t

  type 'a elt = _elt
  type 'a t = _t

  include (IntSetSet: Set.S with type elt := _elt and type t := _t)
end

module Set = Index.Unsafe.Coerce(FSetSet)(FIntSetSet)

module FSetMap (X : Index.Unsafe.T) = struct
  module type S = sig
    include SetSig.StdMapS1 with type ('n, 'a) t = 'a IntSetMap.t
                             and type 'n key = 'n X.t IndexSet.t
  end
end

module FIntSetMap : FSetMap(Index.Unsafe.Int).S =
struct
  type _key = IntSet.t
  type 'a _t = 'a IntSetMap.t

  type 'n key = _key
  type ('n, 'a) t = 'a _t

  include (IntSetMap: Map.S with type key := _key and type 'a t := 'a _t)
end

module Map = Index.Unsafe.Coerce(FSetMap)(FIntSetMap)