Module Middleend.Anf

Copyright 2025-2026, Victoria Ostrovskaya & Danil Usoltsev

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

type immediate =
  1. | ImmediateConst of Frontend.Ast.const
  2. | ImmediateVar of Frontend.Ast.ident
val pp_immediate : Ppx_deriving_runtime.Format.formatter -> immediate -> Ppx_deriving_runtime.unit
val show_immediate : immediate -> Ppx_deriving_runtime.string
type complex_expr =
  1. | ComplexImmediate of immediate
  2. | ComplexUnit
  3. | ComplexBinOper of Frontend.Ast.bin_oper * immediate * immediate
  4. | ComplexUnarOper of Frontend.Ast.unar_oper * immediate
  5. | ComplexTuple of immediate * immediate * immediate list
  6. | ComplexField of immediate * int
  7. | ComplexList of immediate list
  8. | ComplexOption of immediate option
  9. | ComplexApp of immediate * immediate * immediate list
  10. | ComplexLambda of Frontend.Ast.pattern list * anf_expr
  11. | ComplexBranch of immediate * anf_expr * anf_expr
and anf_expr =
  1. | AnfLet of Frontend.Ast.is_rec * Frontend.Ast.ident * complex_expr * anf_expr
  2. | AnfExpr of complex_expr
val pp_complex_expr : Ppx_deriving_runtime.Format.formatter -> complex_expr -> Ppx_deriving_runtime.unit
val show_complex_expr : complex_expr -> Ppx_deriving_runtime.string
val pp_anf_expr : Ppx_deriving_runtime.Format.formatter -> anf_expr -> Ppx_deriving_runtime.unit
val show_anf_expr : anf_expr -> Ppx_deriving_runtime.string
type arity = int
type anf_bind = Frontend.Ast.ident * anf_expr
val pp_anf_bind : Ppx_deriving_runtime.Format.formatter -> anf_bind -> Ppx_deriving_runtime.unit
val show_anf_bind : anf_bind -> Ppx_deriving_runtime.string
type anf_fun_bind = Frontend.Ast.ident * arity * anf_expr
val pp_anf_fun_bind : Ppx_deriving_runtime.Format.formatter -> anf_fun_bind -> Ppx_deriving_runtime.unit
val show_anf_fun_bind : anf_fun_bind -> Ppx_deriving_runtime.string
type anf_structure =
  1. | AnfEval of anf_expr
  2. | AnfValue of Frontend.Ast.is_rec * anf_fun_bind * anf_fun_bind list
val pp_anf_structure : Ppx_deriving_runtime.Format.formatter -> anf_structure -> Ppx_deriving_runtime.unit
val show_anf_structure : anf_structure -> Ppx_deriving_runtime.string
type anf_program = anf_structure list
val pp_anf_program : Ppx_deriving_runtime.Format.formatter -> anf_program -> Ppx_deriving_runtime.unit
val show_anf_program : anf_program -> Ppx_deriving_runtime.string
val anf_program : Frontend.Ast.program -> (anf_program, string) Stdlib.Result.t