import * as Ast from "../generated/crochet-grammar"; import * as IR from "../ir"; declare type uint32 = number; declare type range_key = string & { __range_key__: 0; }; declare class Context { readonly filename: string; readonly source: string; private id2meta; private range2id; private next_id; private name_id; constructor(filename: string, source: string); register(meta: Ast.Meta): number; meta_to_interval(meta: Ast.Meta): IR.Interval; make_range_key(meta: Ast.Meta): range_key; generate_meta_table(): Map; fresh_name(prefix: string): string; } declare type InterpolationPart = IPEscape | IPStatic | IPDynamic; declare abstract class InterpolationPartBase { merge(that: InterpolationPart): InterpolationPart | null; apply_indent(re: RegExp): InterpolationPart; trim_start(): InterpolationPart; trim_end(): InterpolationPart; resolve_escapes(): InterpolationPart; compile(on_static: (x: string) => U, on_dynamic: (_: T) => U): U; abstract static_compile(): string | null; } declare class IPStatic extends InterpolationPartBase { readonly value: string; constructor(value: string); merge(that: InterpolationPart): IPStatic | null; apply_indent(re: RegExp): IPStatic; trim_start(): IPStatic; trim_end(): IPStatic; static_compile(): string; } declare class IPEscape extends InterpolationPartBase { readonly code: string; constructor(code: string); resolve_escapes(): IPStatic; static_compile(): null; } declare class IPDynamic extends InterpolationPartBase { readonly body: T; constructor(body: T); compile(on_static: (_: string) => U, on_dynamic: (_: T) => U): U; static_compile(): null; } export declare function from_enum_integer(meta: number, type: IR.Type, variants: Ast.Name[]): IR.DCommand; export declare class LowerToIR { readonly context: Context; constructor(context: Context); documentation(x: Ast.Metadata): string; type_def(x: Ast.TypeDef): void; type_parent(x: Ast.TypeConstraint | null): IR.TypeConstraint; type(x: Ast.TypeApp): IR.Type; type_constraint(x: Ast.TypeConstraint): IR.TypeConstraint; trait(x: Ast.Trait): IR.LocalTrait; parameter(x: Ast.Parameter): { type: IR.TypeConstraint; parameter: string; }; parameters(xs0: Ast.Parameter[]): { types: IR.TypeConstraint[]; parameters: string[]; }; typeFields(fields: Ast.TypeField[]): { globals: string[]; types: IR.TypeConstraint[]; parameters: string[]; }; interpolation_part(x: Ast.InterpolationPart): InterpolationPart; interpolation_parts(pos: Ast.Meta, xs: Ast.InterpolationPart[]): InterpolationPart[]; literal(x: Ast.Literal): IR.Literal; pattern(x: Ast.Pattern): IR.Pattern; predicate(x: Ast.Predicate): IR.Predicate; relation_type(x: Ast.RelationPart): IR.RelationType; relation_types(xs: Ast.RelationPart[]): IR.RelationType[]; rank_function(x: Ast.Rank): IR.BasicBlock; simulation_context(x: Ast.SimulationContext): string | null; simulation_goal(x: Ast.SimulationGoal): IR.SimulationGoal; simulation_signal(x: Ast.Signal): IR.SimulationSignal; simulation_title(pos: Ast.Meta, type: IR.Type, name: string, title0: Ast.Expression | null): IR.DCommand[]; record_field(x: Ast.RecordField): { static: true; name: string; } | { static: false; expr: IR.Op[]; }; record_pairs(xs0: Ast.Pair[]): { pairs: { key: string; value: IR.Op[]; }[]; dynamic_pairs: { pos: number; expr: IR.Op[]; value: IR.Op[]; }[]; }; comprehension(x: Ast.ForExpression): IR.Op[]; make_partial_lambda(meta: number, args: Ast.Expression[], expr: (all: string[]) => IR.Op[]): IR.Op[]; reify_subexpressions(x: Ast.Expression): [null | [string, string[]], IR.Op[]]; expression(x: Ast.Expression): IR.Op[]; dsl_node(x: Ast.DslAst): IR.DslNode; dsl_meta(x: Ast.Meta): IR.DslMeta; dsl_signature(xs: Ast.DslSignature[]): { name: string; values: Ast.DslAst[]; }; dsl_attributes(xs: Ast.DslAttr[]): Map; handlers(handlers: Ast.Handler[]): IR.HandlerCase[]; handler(handler: Ast.Handler): IR.HandlerCase; statements(xs: Ast.Statement[]): IR.BasicBlock; fun_body(xs: Ast.Statement[]): IR.Op[]; statement(x: Ast.Statement): IR.Op[]; expand_type_initialiser(type: Ast.TypeConstraint, name: Ast.Expression, x: Ast.TypeInit): Ast.Declaration | Ast.Statement; type_initialiser(pos: Ast.Meta, name: string, init0: Ast.TypeInit[], context: string | null): IR.Declaration[]; singleton_type(pos: Ast.Meta, id: uint32, cmeta: Ast.Metadata, name: string, parent: IR.TypeConstraint, init: Ast.TypeInit[], context: string | null): IR.Declaration[]; contract_condition(kind: IR.AssertType, contract: Ast.ContractCondition): IR.Op[]; contract_conditions(kind: IR.AssertType, xs: Ast.ContractCondition[]): IR.Op[]; contract_return(ret: Ast.TypeConstraint | null): (IR.PushReturn | IR.Assert | IR.TypeTest)[]; declaration(x: Ast.Declaration, context: string | null): IR.Declaration[]; declarations(xs: Ast.Declaration[], context: string | null): IR.Declaration[]; } export declare function lower_to_ir(filename: string, source: string, program: Ast.Program): IR.Program; export declare function lower_declarations(source: string, xs: Ast.Declaration[]): { declarations: IR.Declaration[]; meta: Map; }; export declare function lower_statements(source: string, xs: Ast.Statement[]): { block: IR.BasicBlock; meta: Map; }; export declare function lower_to_repl(source: string, x: Ast.REPL): IR.ReplNode; export {};