Module Tenyaeva_lib.Ast

Copyright 2025, Tenyaeva Ekaterina

SPDX-License-Identifier: LGPL-3.0-or-later

type ident = Base.string
val pp_ident : Ppx_deriving_runtime.Format.formatter -> ident -> Ppx_deriving_runtime.unit
val show_ident : ident -> Ppx_deriving_runtime.string
val is_keyword : string -> bool
val gen_char : char QCheck.Gen.t
val gen_filtered_ident : string QCheck.Gen.t -> string QCheck.Gen.t
val gen_ident : string QCheck.Gen.t
type constant =
  1. | Const_int of Base.int
    (*

    integer, e.g. 122

    *)
  2. | Const_bool of Base.bool
    (*

    boolean, e.g. true

    *)
  3. | Const_unit
    (*

    ()

    *)
val pp_constant : Ppx_deriving_runtime.Format.formatter -> constant -> Ppx_deriving_runtime.unit
val show_constant : constant -> Ppx_deriving_runtime.string
val gen_constant : constant QCheck.Gen.t
val arb_constant : constant QCheck.arbitrary
type rec_flag =
  1. | Recursive
    (*

    recursive

    *)
  2. | NonRecursive
    (*

    non-recursive

    *)
val pp_rec_flag : Ppx_deriving_runtime.Format.formatter -> rec_flag -> Ppx_deriving_runtime.unit
val show_rec_flag : rec_flag -> Ppx_deriving_runtime.string
val gen_rec_flag : rec_flag QCheck.Gen.t
val arb_rec_flag : rec_flag QCheck.arbitrary
type binary_op =
  1. | Add
    (*

    +

    *)
  2. | Mult
    (*

    *

    *)
  3. | Sub
    (*

    -

    *)
  4. | Div
    (*

    /

    *)
  5. | Gt
    (*

    >

    *)
  6. | Lt
    (*

    <

    *)
  7. | Eq
    (*

    =

    *)
  8. | Neq
    (*

    <>

    *)
  9. | Gte
    (*

    >=

    *)
  10. | Lte
    (*

    <=

    *)
val pp_binary_op : Ppx_deriving_runtime.Format.formatter -> binary_op -> Ppx_deriving_runtime.unit
val show_binary_op : binary_op -> Ppx_deriving_runtime.string
val gen_binary_op : binary_op QCheck.Gen.t
val arb_binary_op : binary_op QCheck.arbitrary
type unary_op =
  1. | Negative
    (*

    unary minus, e.g. -5

    *)
  2. | Positive
    (*

    unary plus, e.g. +5

    *)
  3. | Not
    (*

    not

    *)
val pp_unary_op : Ppx_deriving_runtime.Format.formatter -> unary_op -> Ppx_deriving_runtime.unit
val show_unary_op : unary_op -> Ppx_deriving_runtime.string
val gen_unary_op : unary_op QCheck.Gen.t
val arb_unary_op : unary_op QCheck.arbitrary
type type_annot =
  1. | Type_int
    (*

    integer type - int

    *)
  2. | Type_bool
    (*

    boolean type - bool

    *)
  3. | Type_unit
    (*

    unit type - unit

    *)
  4. | Type_var of ident
    (*

    variable type

    *)
  5. | Type_arrow of type_annot * type_annot
    (*

    arrow type

    *)
  6. | Type_option of type_annot
    (*

    type option

    *)
val pp_type_annot : Ppx_deriving_runtime.Format.formatter -> type_annot -> Ppx_deriving_runtime.unit
val show_type_annot : type_annot -> Ppx_deriving_runtime.string
val gen_type_annot_sized : int -> type_annot QCheck.Gen.t
val gen_type_annot : type_annot QCheck.Gen.t
val arb_type_annot_sized : int -> type_annot QCheck.arbitrary
val arb_type_annot : type_annot QCheck.arbitrary
type pattern =
  1. | Pat_any
    (*

    matches any value without binding it - _

    *)
  2. | Pat_var of ident
    (*

    matches any value and binds it to a variable, e.g. x

    *)
  3. | Pat_constant of constant
    (*

    matches a constant value, e.g. 42, true

    *)
  4. | Pat_option of pattern Base.option
    (*

    matches an optional pattern, e.g. Some x or None

    *)
  5. | Pat_constraint of type_annot * pattern
    (*

    typed pattern, e.g. a: int

    *)
val pp_pattern : Ppx_deriving_runtime.Format.formatter -> pattern -> Ppx_deriving_runtime.unit
val show_pattern : pattern -> Ppx_deriving_runtime.string
val gen_pattern_sized : int -> pattern QCheck.Gen.t
val gen_pattern : pattern QCheck.Gen.t
val arb_pattern_sized : int -> pattern QCheck.arbitrary
val arb_pattern : pattern QCheck.arbitrary
type expression =
  1. | Expr_const of constant
    (*

    constant, e.g. 10

    *)
  2. | Expr_ident of ident
    (*

    variable, e.g. x

    *)
  3. | Expr_option of expression Base.option
    (*

    optonal expression, e.g. Some x

    *)
  4. | Expr_constraint of type_annot * expression
    (*

    typed expression, e.g. a: int

    *)
  5. | Expr_binop of binary_op * expression * expression
    (*

    binary operation, e.g. 1 + 5

    *)
  6. | Expr_unop of unary_op * expression
    (*

    unary operation, e.g. -7

    *)
  7. | Expr_fun of pattern * expression
    (*

    function, e.g. fun (x, y) -> x + y

    *)
  8. | Expr_apply of expression * expression
    (*

    application, e.g. (fun (x, y) -> x + y) (1, 2)

    *)
  9. | Expr_if of expression * expression * expression Base.option
    (*

    conditional expression, e.g. if a then b else c

    *)
  10. | Expr_let of rec_flag * value_binding * value_binding Base.list * expression
    (*

    let, e.g. let x = 5

    *)
  11. | Expr_function of case * case Base.list
    (*

    function, e.g. fun (x, y) -> x + y

    *)
  12. | Expr_match of expression * case * case Base.list
    (*

    pattern matching, e.g. match x with | 0 -> "zero" | _ -> "nonzero"

    *)
and value_binding = {
  1. vb_pat : pattern;
    (*

    the pattern being bound, e.g. x, (a, b)

    *)
  2. vb_expr : expression;
    (*

    the expression being assigned, e.g. 42, fun x -> x + 1

    *)
}
and case = {
  1. case_pat : pattern;
    (*

    the pattern to match, e.g. x, _

    *)
  2. case_expr : expression;
    (*

    the expression to evaluate if the pattern matches

    *)
}
val pp_expression : Ppx_deriving_runtime.Format.formatter -> expression -> Ppx_deriving_runtime.unit
val show_expression : expression -> Ppx_deriving_runtime.string
val pp_value_binding : Ppx_deriving_runtime.Format.formatter -> value_binding -> Ppx_deriving_runtime.unit
val show_value_binding : value_binding -> Ppx_deriving_runtime.string
val pp_case : Ppx_deriving_runtime.Format.formatter -> case -> Ppx_deriving_runtime.unit
val show_case : case -> Ppx_deriving_runtime.string
type structure_item =
  1. | Str_eval of expression
    (*

    an expression to be evaluated but not bound, e.g. 1 + 2

    *)
  2. | Str_value of rec_flag * value_binding * value_binding Base.list
    (*

    a value or function binding, e.g. let x = 1

    *)
val pp_structure_item : Ppx_deriving_runtime.Format.formatter -> structure_item -> Ppx_deriving_runtime.unit
val show_structure_item : structure_item -> Ppx_deriving_runtime.string
type structure = structure_item Base.list

full program

val pp_structure : Ppx_deriving_runtime.Format.formatter -> structure -> Ppx_deriving_runtime.unit
val show_structure : structure -> Ppx_deriving_runtime.string