package herdtools7

  1. Overview
  2. Docs

Static Environment used for type-checking (cf Typing.

type global = {
  1. declared_types : AST.ty ASTUtils.IMap.t;
    (*

    Maps a type name t to its declaration.

    *)
  2. constant_values : AST.literal ASTUtils.IMap.t;
    (*

    Maps a global constant name to its value.

    *)
  3. storage_types : (AST.ty * AST.global_decl_keyword) ASTUtils.IMap.t;
    (*

    Maps global declared storage elements to their types.

    *)
  4. subtypes : AST.identifier ASTUtils.IMap.t;
    (*

    Maps an identifier s to its parent in the subtype relation.

    *)
  5. subprograms : AST.func ASTUtils.IMap.t;
    (*

    Maps each subprogram runtime name to its signature.

    *)
  6. subprogram_renamings : ASTUtils.ISet.t ASTUtils.IMap.t;
    (*

    Maps each subprogram declared name to the equivalence class of all the subprogram runtime names that were declared with this name.

    *)
}

Store all the global environment information at compile-time.

type local = {
  1. constant_values : AST.literal ASTUtils.IMap.t;
    (*

    Maps a local constant to its value.

    *)
  2. storage_types : (AST.ty * AST.local_decl_keyword) ASTUtils.IMap.t;
    (*

    Maps an locally declared names to their type.

    *)
  3. return_type : AST.ty option;
    (*

    Local return type, None for procedures, global constants, or setters.

    *)
}

Store all the local environment information at compile-time.

type env = {
  1. global : global;
  2. local : local;
}

The static environment type.

val pp_env : Format.formatter -> env -> unit
val pp_global : Format.formatter -> global -> unit
val empty_global : global
val empty_local : local
val empty_local_return_type : AST.ty option -> local
val empty : env
val lookup_constants : env -> AST.identifier -> AST.literal
val type_of : env -> AST.identifier -> AST.ty
val type_of_opt : env -> AST.identifier -> AST.ty option
val mem_constants : env -> AST.identifier -> bool
val add_subprogram : AST.identifier -> AST.func -> env -> env
val set_renamings : AST.identifier -> ASTUtils.ISet.t -> env -> env
val add_global_storage : AST.identifier -> AST.ty -> AST.global_decl_keyword -> env -> env
val add_type : AST.identifier -> AST.ty -> env -> env
val add_global_constant : AST.identifier -> AST.literal -> env -> env
val add_local_constant : AST.identifier -> AST.literal -> env -> env
val add_local : AST.identifier -> AST.ty -> AST.local_decl_keyword -> env -> env
val add_subtype : AST.identifier -> AST.identifier -> env -> env
val is_undefined : AST.identifier -> env -> bool
OCaml

Innovation. Community. Security.