sig
  type ginput =
      IOStatement of Galax_io.input_spec
    | IOProlog of Galax_io.input_spec
    | IOLibraryModule of Galax_io.input_spec
    | IOMainModule of Galax_io.input_spec
  type ast =
      ASTStatement of Xquery_ast.statement
    | ASTProlog of Xquery_ast.prolog
    | ASTLibraryModule of Xquery_ast.library_module
    | ASTMainModule of Xquery_ast.main_module
  type core_ast =
      CoreASTStatement of Xquery_core_ast.acstatement
    | CoreASTProlog of Xquery_core_ast.acprolog
    | CoreASTLibraryModule of Xquery_core_ast.acxmodule
    | CoreASTMainModule of Xquery_core_ast.acxmodule
  type logical_plan =
      LogicalPlanStatement of Logical_algebra_types.logical_algop_expr
    | LogicalPlanProlog of Logical_algebra_types.logical_algop_prolog
    | LogicalPlanLibraryModule of Logical_algebra_types.logical_algop_xmodule
    | LogicalPlanMainModule of Logical_algebra_types.logical_algop_xmodule
  type logical_plan_statement = Logical_algebra_types.logical_algop_expr
  type logical_plan_main_module = Logical_algebra_types.logical_algop_xmodule
  type physical_plan =
      PhysicalPlanStatement of Algebra_type.algop_expr
    | PhysicalPlanProlog of Algebra_type.algop_prolog
    | PhysicalPlanLibraryModule of Algebra_type.algop_xmodule
    | PhysicalPlanMainModule of Algebra_type.algop_xmodule
  type external_context = {
    external_context_item : Physical_value.item option;
    external_timezone : Dm_atomic.atomicDayTimeDuration option;
    external_variables :
      (Xquery_common_ast.cvname * Physical_value.item list) list;
  }
  val create_external_context :
    Processing_context.processing_context ->
    Physical_value.item option ->
    Dm_atomic.atomicDayTimeDuration option ->
    (string * Physical_value.item list) list ->
    Procmod_compiler.external_context
  val default_external_context : unit -> Procmod_compiler.external_context
  val logical_compile_statement :
    Compiled_program_units.compiled_program ->
    Galax_io.input_spec ->
    Compiled_program_units.compiled_program *
    Compiled_program_units.logical_compiled_statement
  val compile_statement :
    Compiled_program_units.compiled_program ->
    Galax_io.input_spec ->
    Compiled_program_units.compiled_program *
    Compiled_program_units.compiled_statement
  val compile_statement_from_logical_plan :
    Compiled_program_units.compiled_program ->
    Compiled_program_units.compiled_prolog ->
    Procmod_compiler.logical_plan_statement ->
    Compiled_program_units.compiled_program *
    Compiled_program_units.compiled_statement
  val compile_statement_from_optimized_logical_plan :
    Compiled_program_units.compiled_program ->
    Procmod_compiler.logical_plan_statement ->
    Compiled_program_units.compiled_program *
    Compiled_program_units.compiled_statement
  val compile_prolog :
    bool ->
    Compiled_program_units.compiled_program ->
    Galax_io.input_spec -> Compiled_program_units.compiled_program
  val logical_compile_main_module :
    bool ->
    Compiled_program_units.compiled_program ->
    Galax_io.input_spec ->
    Compiled_program_units.compiled_program *
    (Logical_algebra_types.logical_compile_context *
     Procmod_compiler.logical_plan_main_module)
  val compile_library_module :
    Compiled_program_units.compiled_program ->
    Galax_io.input_spec ->
    Namespace_names.ncname * string * Compiled_program_units.compiled_program
  val compile_main_module :
    bool ->
    Compiled_program_units.compiled_program ->
    Galax_io.input_spec ->
    Compiled_program_units.compiled_program *
    Compiled_program_units.compiled_statement list
  val compile_main_module_from_logical_plan :
    Compiled_program_units.compiled_program ->
    Logical_algebra_types.logical_compile_context *
    Procmod_compiler.logical_plan_main_module ->
    Compiled_program_units.compiled_program *
    Compiled_program_units.compiled_statement list
  val compile_main_module_from_optimized_logical_plan :
    Compiled_program_units.compiled_program ->
    Logical_algebra_types.logical_compile_context *
    Procmod_compiler.logical_plan_main_module ->
    Compiled_program_units.compiled_program *
    Compiled_program_units.compiled_statement list
  val compile_standard_library_module :
    Processing_context.processing_context ->
    Compiled_program_units.compiled_program
  val prepare_compiled_program :
    Procmod_compiler.external_context option ->
    Compiled_program_units.compiled_program ->
    Compiled_program_units.prepared_program
  val execute_compiled_statement :
    Compiled_program_units.prepared_program ->
    Compiled_program_units.compiled_statement ->
    Physical_value.physical_value
end