Module Acutis_internals.Ast

Define the untyped abstract syntax tree to be generated by the Parser.

type loc = Stdlib.Lexing.position * Stdlib.Lexing.position

This type is equivalent to Menhir's $loc keyword.

val loc_dummy : loc
type 'a assoc = (loc * string * 'a) list
type 'a assoc_nonempty = (loc * string * 'a) Nonempty.t
type tag =
  1. | Tag_int of loc * int
  2. | Tag_bool of loc * int
  3. | Tag_string of loc * string
type 'a value =
  1. | Tag of tag
  2. | Value of 'a
type 'a record = 'a value assoc_nonempty
type row = loc * [ `Closed | `Open ]
type ty =
  1. | Ty_named of loc * string
  2. | Ty_nullable of ty
  3. | Ty_list of ty
  4. | Ty_dict of ty
  5. | Ty_enum_int of (loc * int) Nonempty.t * row
  6. | Ty_enum_bool of (loc * int) Nonempty.t
  7. | Ty_enum_string of (loc * string) Nonempty.t * row
  8. | Ty_record of (loc * ty record) Nonempty.t * row
  9. | Ty_tuple of ty list
type prop = {
  1. loc : loc;
  2. name : string;
  3. ty : ty;
}
type interface = prop list
type trim =
  1. | No_trim
  2. | Trim
type escape =
  1. | No_escape
  2. | Escape
type echo_format =
  1. | Fmt_string
  2. | Fmt_int
  3. | Fmt_float
  4. | Fmt_bool

The echo syntax is essentially a subset of the pattern syntax, one which only allows strings, variables, and record field access.

type echo =
  1. | Echo_var of loc * string
  2. | Echo_string of loc * string
  3. | Echo_field of echo * string
type pat =
  1. | Var of loc * string
  2. | Bool of loc * int
  3. | Int of loc * int
  4. | Float of loc * float
  5. | String of loc * string
  6. | Nullable of loc * pat option
  7. | Enum_string of loc * string
  8. | Enum_int of loc * int
  9. | List of loc * pat list * pat option
  10. | Tuple of loc * pat list
  11. | Record of loc * pat record
  12. | Dict of loc * pat assoc
  13. | Block of loc * t
  14. | Field of loc * pat * string
and node =
  1. | Text of string * trim * trim
  2. | Echo of (echo_format * echo) list * echo_format * echo * escape
  3. | Match of loc * pat Nonempty.t * case Nonempty.t
  4. | Map_list of loc * pat * case Nonempty.t
  5. | Map_dict of loc * pat * case Nonempty.t
  6. | Component of loc * string * string * pat assoc
  7. | Interface of loc * interface
  8. | Comment of string
and case = {
  1. pats : (loc * pat Nonempty.t) Nonempty.t;
  2. nodes : t;
}
and t = node list
val dummy_var : pat

A variable that is always ignored.

module Ty_repr : sig ... end
val pp_tag : Stdlib.Format.formatter -> tag -> unit
val pp_pat : Stdlib.Format.formatter -> pat -> unit