sig
  type syntax_version = V3 | V4
  val merge_version :
    Ast.syntax_version -> Ast.syntax_version -> Ast.syntax_version
  type ('a, 'annot) link =
      ANY_FREE
    | LNK_VALUE of int * 'annot
    | LNK_FREE
    | LNK_ANY
    | LNK_SOME
    | LNK_TYPE of 'a * 'a
  type internal = string option Locality.annot list
  type port = {
    port_nme : string Locality.annot;
    port_int : Ast.internal;
    port_int_mod : string Locality.annot option;
    port_lnk : (string Locality.annot, unit) Ast.link Locality.annot list;
    port_lnk_mod : int Locality.annot option option;
  }
  type counter_test = CEQ of int | CGTE of int | CVAR of string
  type counter = {
    count_nme : string Locality.annot;
    count_test : Ast.counter_test Locality.annot option;
    count_delta : int Locality.annot;
  }
  type site = Port of Ast.port | Counter of Ast.counter
  type agent_mod = Erase | Create
  type agent =
      Present of string Locality.annot * Ast.site list * Ast.agent_mod option
    | Absent of Locality.t
  type mixture = Ast.agent list
  type edit_notation = {
    mix : Ast.mixture;
    delta_token :
      ((Ast.mixture, string) Alg_expr.e Locality.annot *
       string Locality.annot)
      list;
  }
  type arrow_notation = {
    lhs : Ast.mixture;
    rm_token :
      ((Ast.mixture, string) Alg_expr.e Locality.annot *
       string Locality.annot)
      list;
    rhs : Ast.mixture;
    add_token :
      ((Ast.mixture, string) Alg_expr.e Locality.annot *
       string Locality.annot)
      list;
  }
  type rule_content = Edit of Ast.edit_notation | Arrow of Ast.arrow_notation
  type rule = {
    rewrite : Ast.rule_content;
    bidirectional : bool;
    k_def : (Ast.mixture, string) Alg_expr.e Locality.annot;
    k_un :
      ((Ast.mixture, string) Alg_expr.e Locality.annot *
       (Ast.mixture, string) Alg_expr.e Locality.annot option)
      option;
    k_op : (Ast.mixture, string) Alg_expr.e Locality.annot option;
    k_op_un :
      ((Ast.mixture, string) Alg_expr.e Locality.annot *
       (Ast.mixture, string) Alg_expr.e Locality.annot option)
      option;
  }
  val flip_label : string -> string
  type ('pattern, 'mixture, 'id, 'rule) modif_expr =
      APPLY of
        (('pattern, 'id) Alg_expr.e Locality.annot * 'rule Locality.annot)
    | UPDATE of
        ('id Locality.annot * ('pattern, 'id) Alg_expr.e Locality.annot)
    | STOP of ('pattern, 'id) Alg_expr.e Primitives.print_expr list
    | SNAPSHOT of ('pattern, 'id) Alg_expr.e Primitives.print_expr list
    | PRINT of ('pattern, 'id) Alg_expr.e Primitives.print_expr list *
        ('pattern, 'id) Alg_expr.e Primitives.print_expr list
    | PLOTENTRY
    | CFLOWLABEL of (bool * string Locality.annot)
    | CFLOWMIX of (bool * 'pattern Locality.annot)
    | DIN of Primitives.din_kind *
        ('pattern, 'id) Alg_expr.e Primitives.print_expr list
    | DINOFF of ('pattern, 'id) Alg_expr.e Primitives.print_expr list
    | SPECIES_OF of
        (bool * ('pattern, 'id) Alg_expr.e Primitives.print_expr list *
         'pattern Locality.annot)
  type ('pattern, 'mixture, 'id, 'rule) perturbation =
      (Nbr.t option * ('pattern, 'id) Alg_expr.bool Locality.annot option *
       ('pattern, 'mixture, 'id, 'rule) Ast.modif_expr list *
       ('pattern, 'id) Alg_expr.bool Locality.annot option)
      Locality.annot
  type configuration = string Locality.annot * string Locality.annot list
  type ('pattern, 'id) variable_def =
      string Locality.annot * ('pattern, 'id) Alg_expr.e Locality.annot
  type ('mixture, 'id) init_t =
      INIT_MIX of 'mixture Locality.annot
    | INIT_TOK of 'id Locality.annot list
  type ('pattern, 'mixture, 'id) init_statment =
      ('pattern, 'id) Alg_expr.e Locality.annot * ('mixture, 'id) Ast.init_t
  type ('agent, 'pattern, 'mixture, 'id, 'rule) instruction =
      SIG of 'agent
    | TOKENSIG of string Locality.annot
    | VOLSIG of string * float * string
    | INIT of ('pattern, 'mixture, 'id) Ast.init_statment
    | DECLARE of ('pattern, 'id) Ast.variable_def
    | OBS of ('pattern, 'id) Ast.variable_def
    | PLOT of ('pattern, 'id) Alg_expr.e Locality.annot
    | PERT of ('pattern, 'mixture, 'id, 'rule) Ast.perturbation
    | CONFIG of Ast.configuration
    | RULE of (string Locality.annot option * 'rule Locality.annot)
  type ('pattern, 'mixture, 'id, 'rule) command =
      RUN of ('pattern, 'id) Alg_expr.bool Locality.annot
    | MODIFY of ('pattern, 'mixture, 'id, 'rule) Ast.modif_expr list
    | QUIT
  type ('agent, 'pattern, 'mixture, 'id, 'rule) compil = {
    filenames : string list;
    variables : ('pattern, 'id) Ast.variable_def list;
    signatures : 'agent list;
    rules : (string Locality.annot option * 'rule Locality.annot) list;
    observables : ('pattern, 'id) Alg_expr.e Locality.annot list;
    init : ('pattern, 'mixture, 'id) Ast.init_statment list;
    perturbations : ('pattern, 'mixture, 'id, 'rule) Ast.perturbation list;
    configurations : Ast.configuration list;
    tokens : string Locality.annot list;
    volumes : (string * float * string) list;
  }
  type parsing_compil =
      (Ast.agent, Ast.mixture, Ast.mixture, string, Ast.rule) Ast.compil
  type parsing_instruction =
      (Ast.agent, Ast.mixture, Ast.mixture, string, Ast.rule) Ast.instruction
  val empty_compil : Ast.parsing_compil
  val no_more_site_on_right : bool -> Ast.site list -> Ast.site list -> bool
  val split_mixture : Ast.mixture -> Ast.mixture * Ast.mixture
  val implicit_signature : Ast.parsing_compil -> Ast.parsing_compil
  val print_link :
    ('-> Format.formatter -> '-> unit) ->
    (Format.formatter -> '-> unit) ->
    (Format.formatter -> '-> unit) ->
    Format.formatter -> ('a, 'b) Ast.link -> unit
  val print_counter : Format.formatter -> Ast.counter -> unit
  val print_ast_mix : Format.formatter -> Ast.mixture -> unit
  val print_ast_rule : Format.formatter -> Ast.rule -> unit
  val print_rule_content :
    bidirectional:bool -> Format.formatter -> Ast.rule_content -> unit
  val to_erased_mixture : Ast.mixture -> Ast.mixture
  val to_created_mixture : Ast.mixture -> Ast.mixture
  val link_to_json :
    ('-> '-> Yojson.Basic.json) ->
    ('-> Yojson.Basic.json) ->
    ('-> Yojson.Basic.json list) -> ('a, 'b) Ast.link -> Yojson.Basic.json
  val link_of_json :
    ('-> Yojson.Basic.json -> 'a) ->
    (Yojson.Basic.json -> 'a) ->
    (Yojson.Basic.json list -> 'b) -> Yojson.Basic.json -> ('a, 'b) Ast.link
  val compil_of_json : Yojson.Basic.json -> Ast.parsing_compil
  val compil_to_json : Ast.parsing_compil -> Yojson.Basic.json
end