prolog-trace-viz 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +148 -0
- package/dist/analyzer.d.ts +64 -0
- package/dist/analyzer.d.ts.map +1 -0
- package/dist/analyzer.js +903 -0
- package/dist/analyzer.js.map +1 -0
- package/dist/build-info.d.ts +15 -0
- package/dist/build-info.d.ts.map +1 -0
- package/dist/build-info.js +26 -0
- package/dist/build-info.js.map +1 -0
- package/dist/clauses.d.ts +15 -0
- package/dist/clauses.d.ts.map +1 -0
- package/dist/clauses.js +80 -0
- package/dist/clauses.js.map +1 -0
- package/dist/cli.d.ts +34 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +162 -0
- package/dist/cli.js.map +1 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +66 -0
- package/dist/errors.js.map +1 -0
- package/dist/executor.d.ts +25 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +115 -0
- package/dist/executor.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/dist/mermaid.d.ts +47 -0
- package/dist/mermaid.d.ts.map +1 -0
- package/dist/mermaid.js +197 -0
- package/dist/mermaid.js.map +1 -0
- package/dist/output.d.ts +24 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +40 -0
- package/dist/output.js.map +1 -0
- package/dist/parser.d.ts +84 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +1007 -0
- package/dist/parser.js.map +1 -0
- package/dist/prolog-parser.d.ts +2 -0
- package/dist/prolog-parser.d.ts.map +1 -0
- package/dist/prolog-parser.js +2 -0
- package/dist/prolog-parser.js.map +1 -0
- package/dist/renderer.d.ts +33 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/renderer.js +131 -0
- package/dist/renderer.js.map +1 -0
- package/dist/wrapper.d.ts +30 -0
- package/dist/wrapper.d.ts.map +1 -0
- package/dist/wrapper.js +87 -0
- package/dist/wrapper.js.map +1 -0
- package/package.json +55 -0
- package/scripts/generate-build-info.js +63 -0
- package/scripts/release.js +151 -0
- package/tracer.pl +202 -0
package/dist/parser.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface Unification {
|
|
2
|
+
variable: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export interface TraceEvent {
|
|
6
|
+
port: 'call' | 'exit' | 'redo' | 'fail';
|
|
7
|
+
level: number;
|
|
8
|
+
goal: string;
|
|
9
|
+
arguments?: any[];
|
|
10
|
+
clause?: {
|
|
11
|
+
head: string;
|
|
12
|
+
body: string;
|
|
13
|
+
line: number;
|
|
14
|
+
};
|
|
15
|
+
predicate: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ExecutionNode {
|
|
18
|
+
id: string;
|
|
19
|
+
type: 'query' | 'goal' | 'success' | 'failure';
|
|
20
|
+
goal: string;
|
|
21
|
+
binding?: string;
|
|
22
|
+
unifications?: Unification[];
|
|
23
|
+
clauseNumber?: number;
|
|
24
|
+
clauseLine?: number;
|
|
25
|
+
children: ExecutionNode[];
|
|
26
|
+
subgoals?: string[];
|
|
27
|
+
level: number;
|
|
28
|
+
arguments?: any[];
|
|
29
|
+
}
|
|
30
|
+
export interface Bundle {
|
|
31
|
+
goal: string;
|
|
32
|
+
chunks: Chunk[];
|
|
33
|
+
subgoals?: string[];
|
|
34
|
+
}
|
|
35
|
+
export interface Chunk {
|
|
36
|
+
binding?: string;
|
|
37
|
+
content: string | Bundle | Tabular;
|
|
38
|
+
}
|
|
39
|
+
export interface Tabular {
|
|
40
|
+
type: 'tabular';
|
|
41
|
+
subgoals: string[];
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Parses sldnfdraw LaTeX output into an execution tree.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseLatex(latex: string): ExecutionNode;
|
|
47
|
+
/**
|
|
48
|
+
* Extracts all top-level bundle structures from LaTeX content.
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractBundles(latex: string): Bundle[];
|
|
51
|
+
/**
|
|
52
|
+
* Extracts chunks from bundle content.
|
|
53
|
+
*/
|
|
54
|
+
export declare function extractChunks(content: string): Chunk[];
|
|
55
|
+
/**
|
|
56
|
+
* Serializes an ExecutionNode back to LaTeX format (for round-trip testing).
|
|
57
|
+
*/
|
|
58
|
+
export declare function serializeToLatex(node: ExecutionNode): string;
|
|
59
|
+
/**
|
|
60
|
+
* Parses JSON trace events from the custom tracer into an execution tree.
|
|
61
|
+
*/
|
|
62
|
+
export declare function parseTraceJson(json: string): ExecutionNode;
|
|
63
|
+
/**
|
|
64
|
+
* Clears internal caches to free memory.
|
|
65
|
+
* Call this periodically when processing many large traces.
|
|
66
|
+
*/
|
|
67
|
+
export declare function clearParserCaches(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Performance benchmark results
|
|
70
|
+
*/
|
|
71
|
+
export interface BenchmarkResult {
|
|
72
|
+
parseTime: number;
|
|
73
|
+
eventsPerSecond: number;
|
|
74
|
+
memoryUsed: number;
|
|
75
|
+
nodeCount: number;
|
|
76
|
+
maxDepth: number;
|
|
77
|
+
cacheHitRate?: number;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Benchmarks the JSON parser performance with the given trace data.
|
|
81
|
+
* Returns detailed performance metrics.
|
|
82
|
+
*/
|
|
83
|
+
export declare function benchmarkParser(json: string): BenchmarkResult;
|
|
84
|
+
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MA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