package p4spectec

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file typdef.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
open Lang
open Il
open Il.Print

[@@@ocamlformat "disable"]

(* Type definitions *)

type t =
  (* Type parameter *)
  | Param
  (* Extern type *)
  | Extern
  (* Type being defined *)
  | Defining of tparam list
  (* Type that is completely defined *)
  | Defined of tparam list * deftyp
[@@@ocamlformat "enable"]

let to_string = function
  | Param -> "Param"
  | Extern -> "Extern"
  | Defining tparams -> "Defining" ^ string_of_tparams tparams
  | Defined (tparams, deftyp) ->
      "Defined " ^ string_of_tparams tparams ^ " " ^ string_of_deftyp deftyp

let get_tparams = function
  | Param | Extern -> []
  | Defining tparams -> tparams
  | Defined (tparams, _) -> tparams