Module C_sharp_strange_lib.Ast

Copyright 2026, Dmitrii Kuznetsov

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

type val_type =
  1. | ValInt of int
    (*

    Int value

    *)
  2. | ValChar of char
    (*

    Char value

    *)
  3. | ValNull
    (*

    Null

    *)
  4. | ValBool of bool
    (*

    Bool value

    *)
  5. | ValString of string
    (*

    string value

    *)

Values types

val equal_val_type : val_type -> val_type -> Ppx_deriving_runtime.bool
val pp_val_type : Ppx_deriving_runtime.Format.formatter -> val_type -> Ppx_deriving_runtime.unit
val show_val_type : val_type -> Ppx_deriving_runtime.string
type ident =
  1. | Id of string

Identidicator

val equal_ident : ident -> ident -> Ppx_deriving_runtime.bool
val pp_ident : Ppx_deriving_runtime.Format.formatter -> ident -> Ppx_deriving_runtime.unit
val show_ident : ident -> Ppx_deriving_runtime.string
type base_type =
  1. | TypeInt
    (*

    Declaration of int

    *)
  2. | TypeChar
    (*

    Declaration of char

    *)
  3. | TypeBool
    (*

    Declaration of bool

    *)
  4. | TypeString
    (*

    Declaration of string

    *)

Basic types declarations

val equal_base_type : base_type -> base_type -> Ppx_deriving_runtime.bool
val pp_base_type : Ppx_deriving_runtime.Format.formatter -> base_type -> Ppx_deriving_runtime.unit
val show_base_type : base_type -> Ppx_deriving_runtime.string
type _type =
  1. | TypeBase of base_type
    (*

    Declaration of basic type

    *)
  2. | TypeVoid
    (*

    Declaration of void

    *)

Type delcaration

val equal__type : _type -> _type -> Ppx_deriving_runtime.bool
val pp__type : Ppx_deriving_runtime.Format.formatter -> _type -> Ppx_deriving_runtime.unit
val show__type : _type -> Ppx_deriving_runtime.string
type var_type =
  1. | TypeVar of _type

Variable

val equal_var_type : var_type -> var_type -> Ppx_deriving_runtime.bool
val pp_var_type : Ppx_deriving_runtime.Format.formatter -> var_type -> Ppx_deriving_runtime.unit
val show_var_type : var_type -> Ppx_deriving_runtime.string
type modifier =
  1. | MPublic
    (*

    Public modifier, used for main() method only

    *)
  2. | MStatic
    (*

    Static modifier, used for main() method only

    *)
  3. | MAsync
    (*

    Async modifier

    *)

Modifiers

val equal_modifier : modifier -> modifier -> Ppx_deriving_runtime.bool
val pp_modifier : Ppx_deriving_runtime.Format.formatter -> modifier -> Ppx_deriving_runtime.unit
val show_modifier : modifier -> Ppx_deriving_runtime.string
type var_decl =
  1. | Var of var_type * ident
val equal_var_decl : var_decl -> var_decl -> Ppx_deriving_runtime.bool
val pp_var_decl : Ppx_deriving_runtime.Format.formatter -> var_decl -> Ppx_deriving_runtime.unit
val show_var_decl : var_decl -> Ppx_deriving_runtime.string
type params =
  1. | Params of var_decl list
val equal_params : params -> params -> Ppx_deriving_runtime.bool
val pp_params : Ppx_deriving_runtime.Format.formatter -> params -> Ppx_deriving_runtime.unit
val show_params : params -> Ppx_deriving_runtime.string
type bin_op =
  1. | OpAdd
    (*

    Sum: a + b

    *)
  2. | OpSub
    (*

    a - b

    *)
  3. | OpMul
    (*

    a * b

    *)
  4. | OpDiv
    (*

    a / b in integers

    *)
  5. | OpMod
    (*

    a % b

    *)
  6. | OpEqual
    (*

    a == b

    *)
  7. | OpNonEqual
    (*

    a != b

    *)
  8. | OpLess
    (*

    a < b

    *)
  9. | OpMore
    (*

    a > b

    *)
  10. | OpLessEqual
    (*

    a <= b

    *)
  11. | OpMoreEqual
    (*

    a >= b

    *)
  12. | OpAnd
    (*

    a && b

    *)
  13. | OpOr
    (*

    a || b

    *)
  14. | OpAssign
    (*

    a = b

    *)

Binary operations

val equal_bin_op : bin_op -> bin_op -> Ppx_deriving_runtime.bool
val pp_bin_op : Ppx_deriving_runtime.Format.formatter -> bin_op -> Ppx_deriving_runtime.unit
val show_bin_op : bin_op -> Ppx_deriving_runtime.string
type un_op =
  1. | OpNeg
    (*

    - a

    *)
  2. | OpNot
    (*

    ! a

    *)

Unary operations

val equal_un_op : un_op -> un_op -> Ppx_deriving_runtime.bool
val pp_un_op : Ppx_deriving_runtime.Format.formatter -> un_op -> Ppx_deriving_runtime.unit
val show_un_op : un_op -> Ppx_deriving_runtime.string
type from_clause =
  1. | FromClause of string * ident

From clauses

val equal_from_clause : from_clause -> from_clause -> Ppx_deriving_runtime.bool
val pp_from_clause : Ppx_deriving_runtime.Format.formatter -> from_clause -> Ppx_deriving_runtime.unit
val show_from_clause : from_clause -> Ppx_deriving_runtime.string
type expr =
  1. | EValue of val_type
    (*

    Some value

    *)
  2. | EBinOp of bin_op * expr * expr
    (*

    Binary operation

    *)
  3. | EUnOp of un_op * expr
    (*

    Unary operation

    *)
  4. | EId of ident
    (*

    Identificator expression

    *)
  5. | EArrayAccess of expr * expr
    (*

    Array access: a = arri

    *)
  6. | EFuncCall of expr * args
    (*

    Call of function: name(arguments)

    *)
  7. | EAwait of expr
    (*

    Await expression

    *)

Language expressions

and args =
  1. | Args of expr list
val equal_expr : expr -> expr -> Ppx_deriving_runtime.bool
val equal_args : args -> args -> Ppx_deriving_runtime.bool
val pp_expr : Ppx_deriving_runtime.Format.formatter -> expr -> Ppx_deriving_runtime.unit
val show_expr : expr -> Ppx_deriving_runtime.string
val pp_args : Ppx_deriving_runtime.Format.formatter -> args -> Ppx_deriving_runtime.unit
val show_args : args -> Ppx_deriving_runtime.string
type stmt =
  1. | SFor of stmt option * expr option * expr option * stmt
    (*

    For cycle: for (int i = 0, j = 3; i < 4; i++, j--) {}

    *)
  2. | SIf of expr * stmt * stmt option
    (*

    If condition: if (a) then { b } (else { c } )

    *)
  3. | SWhile of expr * stmt
    (*

    While cycle: while (a) { }

    *)
  4. | SReturn of expr option
    (*

    Return: return (a)

    *)
  5. | SBlock of stmt list
    (*

    Block of statements: { a }; could be empty: {}

    *)
  6. | SBreak
    (*

    Cycle break

    *)
  7. | SContinue
    (*

    Cycle continue

    *)
  8. | SExpr of expr
    (*

    Another expression

    *)
  9. | SDecl of var_decl * expr option
    (*

    Var declaration

    *)

Language statements

val equal_stmt : stmt -> stmt -> Ppx_deriving_runtime.bool
val pp_stmt : Ppx_deriving_runtime.Format.formatter -> stmt -> Ppx_deriving_runtime.unit
val show_stmt : stmt -> Ppx_deriving_runtime.string
type field =
  1. | VarField of modifier list * var_type * ident * expr option
    (*

    Class field - always initialized

    *)
  2. | Method of modifier list * _type * ident * params * stmt
    (*

    Class method

    *)

C Sharp class fields

val equal_field : field -> field -> Ppx_deriving_runtime.bool
val pp_field : Ppx_deriving_runtime.Format.formatter -> field -> Ppx_deriving_runtime.unit
val show_field : field -> Ppx_deriving_runtime.string
type c_sharp_class =
  1. | Class of modifier list * ident * field list
    (*

    Basic class (Program) name

    *)

C Sharp class

val equal_c_sharp_class : c_sharp_class -> c_sharp_class -> Ppx_deriving_runtime.bool
val pp_c_sharp_class : Ppx_deriving_runtime.Format.formatter -> c_sharp_class -> Ppx_deriving_runtime.unit
val show_c_sharp_class : c_sharp_class -> Ppx_deriving_runtime.string
type program =
  1. | Program of c_sharp_class

Program AST

val equal_program : program -> program -> Ppx_deriving_runtime.bool
val pp_program : Ppx_deriving_runtime.Format.formatter -> program -> Ppx_deriving_runtime.unit
val show_program : program -> Ppx_deriving_runtime.string