export interface Unification { variable: string; value: string; } export interface TraceEvent { port: 'call' | 'exit' | 'redo' | 'fail' | 'solution'; level: number; goal: string; arguments?: any[]; unifications?: Unification[]; clause?: { head: string; body: string; line: number; }; predicate: string; parent_info?: { level: number; goal: string; }; /** For 'solution' markers: the query variables' bindings at that solution. */ bindings?: Unification[]; } export interface ExecutionNode { id: string; type: 'query' | 'goal' | 'success' | 'failure'; goal: string; binding?: string; unifications?: Unification[]; clauseNumber?: number; clauseLine?: number; clauseHead?: string; clauseBody?: string; children: ExecutionNode[]; subgoals?: string[]; level: number; arguments?: any[]; } export interface Bundle { goal: string; chunks: Chunk[]; subgoals?: string[]; } export interface Chunk { binding?: string; content: string | Bundle | Tabular; } export interface Tabular { type: 'tabular'; subgoals: string[]; } /** * Parses sldnfdraw LaTeX output into an execution tree. */ export declare function parseLatex(latex: string): ExecutionNode; /** * Extracts all top-level bundle structures from LaTeX content. */ export declare function extractBundles(latex: string): Bundle[]; /** * Extracts chunks from bundle content. */ export declare function extractChunks(content: string): Chunk[]; /** * Serializes an ExecutionNode back to LaTeX format (for round-trip testing). */ export declare function serializeToLatex(node: ExecutionNode): string; /** * Parses JSON trace events from the custom tracer into an execution tree. */ export declare function parseTraceJson(json: string, prologContent?: string): ExecutionNode; /** * Parses JSON array into TraceEvent objects with validation. */ export declare function parseEvents(json: string, prologContent?: string): TraceEvent[]; /** * Clears internal caches to free memory. * Call this periodically when processing many large traces. */ export declare function clearParserCaches(): void; /** * Performance benchmark results */ export interface BenchmarkResult { parseTime: number; eventsPerSecond: number; memoryUsed: number; nodeCount: number; maxDepth: number; cacheHitRate?: number; } /** * Benchmarks the JSON parser performance with the given trace data. * Returns detailed performance metrics. */ export declare function benchmarkParser(json: string): BenchmarkResult; //# sourceMappingURL=parser.d.ts.map