@stevenvo780/st-lang 0.3.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/LICENSE +21 -0
- package/bin/st +3 -0
- package/dist/api.d.ts +157 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +232 -0
- package/dist/api.js.map +1 -0
- package/dist/ast/nodes.d.ts +97 -0
- package/dist/ast/nodes.d.ts.map +1 -0
- package/dist/ast/nodes.js +6 -0
- package/dist/ast/nodes.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +278 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/lexer/lexer.d.ts +25 -0
- package/dist/lexer/lexer.d.ts.map +1 -0
- package/dist/lexer/lexer.js +358 -0
- package/dist/lexer/lexer.js.map +1 -0
- package/dist/lexer/tokens.d.ts +56 -0
- package/dist/lexer/tokens.d.ts.map +1 -0
- package/dist/lexer/tokens.js +85 -0
- package/dist/lexer/tokens.js.map +1 -0
- package/dist/parser/parser.d.ts +46 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +415 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/profiles/classical/first-order.d.ts +13 -0
- package/dist/profiles/classical/first-order.d.ts.map +1 -0
- package/dist/profiles/classical/first-order.js +67 -0
- package/dist/profiles/classical/first-order.js.map +1 -0
- package/dist/profiles/classical/propositional.d.ts +16 -0
- package/dist/profiles/classical/propositional.d.ts.map +1 -0
- package/dist/profiles/classical/propositional.js +597 -0
- package/dist/profiles/classical/propositional.js.map +1 -0
- package/dist/profiles/interface.d.ts +11 -0
- package/dist/profiles/interface.d.ts.map +1 -0
- package/dist/profiles/interface.js +26 -0
- package/dist/profiles/interface.js.map +1 -0
- package/dist/profiles/modal/k.d.ts +13 -0
- package/dist/profiles/modal/k.d.ts.map +1 -0
- package/dist/profiles/modal/k.js +39 -0
- package/dist/profiles/modal/k.js.map +1 -0
- package/dist/profiles/paraconsistent/belnap.d.ts +13 -0
- package/dist/profiles/paraconsistent/belnap.d.ts.map +1 -0
- package/dist/profiles/paraconsistent/belnap.js +39 -0
- package/dist/profiles/paraconsistent/belnap.js.map +1 -0
- package/dist/protocol/handler.d.ts +17 -0
- package/dist/protocol/handler.d.ts.map +1 -0
- package/dist/protocol/handler.js +219 -0
- package/dist/protocol/handler.js.map +1 -0
- package/dist/repl/repl.d.ts +12 -0
- package/dist/repl/repl.d.ts.map +1 -0
- package/dist/repl/repl.js +237 -0
- package/dist/repl/repl.js.map +1 -0
- package/dist/runtime/interpreter.d.ts +41 -0
- package/dist/runtime/interpreter.d.ts.map +1 -0
- package/dist/runtime/interpreter.js +355 -0
- package/dist/runtime/interpreter.js.map +1 -0
- package/dist/tests/cli.test.d.ts +2 -0
- package/dist/tests/cli.test.d.ts.map +1 -0
- package/dist/tests/cli.test.js +184 -0
- package/dist/tests/cli.test.js.map +1 -0
- package/dist/tests/core.test.d.ts +2 -0
- package/dist/tests/core.test.d.ts.map +1 -0
- package/dist/tests/core.test.js +220 -0
- package/dist/tests/core.test.js.map +1 -0
- package/dist/tests/parser.test.d.ts +2 -0
- package/dist/tests/parser.test.d.ts.map +1 -0
- package/dist/tests/parser.test.js +180 -0
- package/dist/tests/parser.test.js.map +1 -0
- package/dist/tests/runner.d.ts +6 -0
- package/dist/tests/runner.d.ts.map +1 -0
- package/dist/tests/runner.js +69 -0
- package/dist/tests/runner.js.map +1 -0
- package/dist/text-layer/compiler.d.ts +19 -0
- package/dist/text-layer/compiler.d.ts.map +1 -0
- package/dist/text-layer/compiler.js +151 -0
- package/dist/text-layer/compiler.js.map +1 -0
- package/dist/types/index.d.ts +178 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 stevenvo780
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/st
ADDED
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import type { Diagnostic, RunResult, SymbolInfo, HoverInfo, CompletionItem, SourceLocation } from './types';
|
|
2
|
+
import type { Program } from './ast/nodes';
|
|
3
|
+
/** Resultado de evaluate() */
|
|
4
|
+
export interface STEvalResult {
|
|
5
|
+
/** true si no hubo errores */
|
|
6
|
+
ok: boolean;
|
|
7
|
+
/** Salida formateada para humanos (lo que imprimiría el CLI) */
|
|
8
|
+
stdout: string;
|
|
9
|
+
/** Errores si los hubo */
|
|
10
|
+
stderr: string;
|
|
11
|
+
/** Código de salida (0 = ok, 1 = parse error, 3 = runtime error) */
|
|
12
|
+
exitCode: number;
|
|
13
|
+
/** Resultados lógicos individuales (uno por cada check/derive/prove/etc) */
|
|
14
|
+
results: RunResult[];
|
|
15
|
+
/** Diagnósticos (errores, warnings, hints) */
|
|
16
|
+
diagnostics: Diagnostic[];
|
|
17
|
+
}
|
|
18
|
+
/** Resultado de parse() */
|
|
19
|
+
export interface STParseResult {
|
|
20
|
+
ok: boolean;
|
|
21
|
+
program: Program | null;
|
|
22
|
+
diagnostics: Diagnostic[];
|
|
23
|
+
}
|
|
24
|
+
/** Resultado de check() */
|
|
25
|
+
export interface STCheckResult {
|
|
26
|
+
ok: boolean;
|
|
27
|
+
diagnostics: Diagnostic[];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Ejecuta código ST completo y devuelve resultado estructurado.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const r = evaluate(`
|
|
35
|
+
* logic classical.propositional
|
|
36
|
+
* axiom a1 : P -> Q
|
|
37
|
+
* axiom a2 : P
|
|
38
|
+
* derive Q from a1, a2
|
|
39
|
+
* `);
|
|
40
|
+
* console.log(r.ok); // true
|
|
41
|
+
* console.log(r.stdout); // "✓ [derive] Q es DERIVABLE..."
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function evaluate(source: string, file?: string): STEvalResult;
|
|
45
|
+
/**
|
|
46
|
+
* Parsea código ST sin ejecutarlo. Útil para validación de sintaxis.
|
|
47
|
+
*/
|
|
48
|
+
export declare function parse(source: string, file?: string): STParseResult;
|
|
49
|
+
/**
|
|
50
|
+
* Verifica sintaxis y bien-formación sin ejecutar comandos lógicos.
|
|
51
|
+
* Parsea el código y reporta errores.
|
|
52
|
+
*/
|
|
53
|
+
export declare function check(source: string, file?: string): STCheckResult;
|
|
54
|
+
/**
|
|
55
|
+
* Evalúa una expresión lógica rápida (auto-prepone "logic classical.propositional").
|
|
56
|
+
* Útil para validaciones inline sin necesidad de declarar perfil.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const r = quickEval('check valid (P -> (Q -> P))');
|
|
61
|
+
* console.log(r.ok); // true
|
|
62
|
+
* console.log(r.results[0].status); // 'valid'
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function quickEval(expression: string): STEvalResult;
|
|
66
|
+
/**
|
|
67
|
+
* Intérprete con estado persistente. Permite ejecutar líneas incrementalmente
|
|
68
|
+
* manteniendo axiomas, teoremas, claims y perfil entre llamadas.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const st = createInterpreter();
|
|
73
|
+
* st.exec('logic classical.propositional');
|
|
74
|
+
* st.exec('axiom a1 : P -> Q');
|
|
75
|
+
* st.exec('axiom a2 : P');
|
|
76
|
+
* const r = st.exec('derive Q from a1, a2');
|
|
77
|
+
* console.log(r.results[0].status); // 'valid'
|
|
78
|
+
* console.log(st.getTheorySummary()); // { axioms: ['a1', 'a2'], ... }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
export interface STInterpreter {
|
|
82
|
+
/** Ejecuta uno o más statements manteniendo el estado */
|
|
83
|
+
exec(source: string): STEvalResult;
|
|
84
|
+
/** Reinicia todo el estado (perfil, axiomas, claims, etc.) */
|
|
85
|
+
reset(): void;
|
|
86
|
+
/** Obtiene el perfil lógico actual */
|
|
87
|
+
getProfile(): string | null;
|
|
88
|
+
/** Lista nombres de axiomas registrados */
|
|
89
|
+
getAxioms(): string[];
|
|
90
|
+
/** Lista nombres de teoremas registrados */
|
|
91
|
+
getTheorems(): string[];
|
|
92
|
+
/** Lista nombres de claims registrados */
|
|
93
|
+
getClaims(): string[];
|
|
94
|
+
/** Resumen completo del estado actual */
|
|
95
|
+
getTheorySummary(): TheorySummary;
|
|
96
|
+
/** Historial de todos los resultados ejecutados */
|
|
97
|
+
getHistory(): STEvalResult[];
|
|
98
|
+
}
|
|
99
|
+
export interface TheorySummary {
|
|
100
|
+
profile: string;
|
|
101
|
+
axioms: string[];
|
|
102
|
+
theorems: string[];
|
|
103
|
+
claims: string[];
|
|
104
|
+
judgmentCount: number;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Crea una instancia de intérprete ST con estado persistente.
|
|
108
|
+
*/
|
|
109
|
+
export declare function createInterpreter(): STInterpreter;
|
|
110
|
+
/** Convierte una fórmula AST a string legible */
|
|
111
|
+
export { formulaToString } from './profiles/classical/propositional';
|
|
112
|
+
/** Lista los perfiles lógicos disponibles */
|
|
113
|
+
export declare function listProfiles(): string[];
|
|
114
|
+
/** Resultado de hover() */
|
|
115
|
+
export interface STHoverResult {
|
|
116
|
+
content: string;
|
|
117
|
+
range?: SourceLocation;
|
|
118
|
+
}
|
|
119
|
+
/** Resultado de render() */
|
|
120
|
+
export interface STRenderResult {
|
|
121
|
+
rendered: string;
|
|
122
|
+
format: string;
|
|
123
|
+
diagnostics: Diagnostic[];
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Obtiene información de hover para una posición en el código ST.
|
|
127
|
+
* Útil para tooltips en editores.
|
|
128
|
+
*
|
|
129
|
+
* @returns HoverInfo o null si no hay info en esa posición
|
|
130
|
+
*/
|
|
131
|
+
export declare function hover(source: string, line: number, column: number, file?: string): HoverInfo | null;
|
|
132
|
+
/**
|
|
133
|
+
* Lista todos los símbolos definidos en el código ST (axiomas, teoremas, claims, passages, etc.).
|
|
134
|
+
* Útil para panel de símbolos en editores.
|
|
135
|
+
*/
|
|
136
|
+
export declare function symbols(source: string, file?: string): SymbolInfo[];
|
|
137
|
+
/**
|
|
138
|
+
* Busca la definición de un símbolo por nombre en el código ST.
|
|
139
|
+
* Útil para "Go to Definition" en editores.
|
|
140
|
+
*
|
|
141
|
+
* @returns SourceLocation de la definición o null si no se encuentra
|
|
142
|
+
*/
|
|
143
|
+
export declare function gotoDefinition(source: string, name: string, file?: string): SourceLocation | null;
|
|
144
|
+
/**
|
|
145
|
+
* Obtiene sugerencias de completado para el lenguaje ST.
|
|
146
|
+
* Devuelve keywords y snippets disponibles.
|
|
147
|
+
*/
|
|
148
|
+
export declare function completion(): CompletionItem[];
|
|
149
|
+
/**
|
|
150
|
+
* Ejecuta y renderiza el código ST en el formato especificado.
|
|
151
|
+
*
|
|
152
|
+
* @param format 'markdown' | 'json' (default: 'markdown')
|
|
153
|
+
*/
|
|
154
|
+
export declare function render(source: string, format?: string, file?: string): STRenderResult;
|
|
155
|
+
export type { ExecutionOutput, Diagnostic, RunResult, Formula, LogicStatus, Theory, TruthTableResult, Proof, Model, Valuation, Severity, FormulaKind, Claim, Passage, Anchor, SymbolInfo, HoverInfo, CompletionItem, SourceLocation, } from './types';
|
|
156
|
+
export type { Program, Statement } from './ast/nodes';
|
|
157
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAEV,UAAU,EACV,SAAS,EAOT,UAAU,EACV,SAAS,EACT,cAAc,EACd,cAAc,EACf,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C,8BAA8B;AAC9B,MAAM,WAAW,YAAY;IAC3B,8BAA8B;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,gEAAgE;IAChE,MAAM,EAAE,MAAM,CAAC;IACf,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,8CAA8C;IAC9C,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,2BAA2B;AAC3B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ACX,MAAM,EACN,gBAAgB,EAChB,KAAK,EACL,KAAK,EACL,SAAS,EACT,QAAQ,EACR,WAAW,EACX,KAAK,EACL,OAAO,EACP,MAAM,EACN,UAAU,EACV,SAAS,EACT,cAAc,EACd,cAAc,GACf,MAAM,SAAS,CAAC;AAEjB,YAAY,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/api.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// ST — API programática para uso como librería
|
|
4
|
+
// ============================================================
|
|
5
|
+
// Uso:
|
|
6
|
+
// import { evaluate, parse, check, createInterpreter } from 'st-lang/api';
|
|
7
|
+
// const result = evaluate('logic classical.propositional\ncheck valid (P -> P)');
|
|
8
|
+
// ============================================================
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.formulaToString = void 0;
|
|
11
|
+
exports.evaluate = evaluate;
|
|
12
|
+
exports.parse = parse;
|
|
13
|
+
exports.check = check;
|
|
14
|
+
exports.quickEval = quickEval;
|
|
15
|
+
exports.createInterpreter = createInterpreter;
|
|
16
|
+
exports.listProfiles = listProfiles;
|
|
17
|
+
exports.hover = hover;
|
|
18
|
+
exports.symbols = symbols;
|
|
19
|
+
exports.gotoDefinition = gotoDefinition;
|
|
20
|
+
exports.completion = completion;
|
|
21
|
+
exports.render = render;
|
|
22
|
+
const parser_1 = require("./parser/parser");
|
|
23
|
+
const interpreter_1 = require("./runtime/interpreter");
|
|
24
|
+
const handler_1 = require("./protocol/handler");
|
|
25
|
+
// ── Funciones estateless (una sola invocación) ────────────────
|
|
26
|
+
/**
|
|
27
|
+
* Ejecuta código ST completo y devuelve resultado estructurado.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const r = evaluate(`
|
|
32
|
+
* logic classical.propositional
|
|
33
|
+
* axiom a1 : P -> Q
|
|
34
|
+
* axiom a2 : P
|
|
35
|
+
* derive Q from a1, a2
|
|
36
|
+
* `);
|
|
37
|
+
* console.log(r.ok); // true
|
|
38
|
+
* console.log(r.stdout); // "✓ [derive] Q es DERIVABLE..."
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
function evaluate(source, file) {
|
|
42
|
+
const interpreter = new interpreter_1.Interpreter();
|
|
43
|
+
const output = interpreter.execute(source, file || '<api>');
|
|
44
|
+
return {
|
|
45
|
+
ok: output.exitCode === 0,
|
|
46
|
+
stdout: output.stdout,
|
|
47
|
+
stderr: output.stderr,
|
|
48
|
+
exitCode: output.exitCode,
|
|
49
|
+
results: output.results,
|
|
50
|
+
diagnostics: output.diagnostics,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Parsea código ST sin ejecutarlo. Útil para validación de sintaxis.
|
|
55
|
+
*/
|
|
56
|
+
function parse(source, file) {
|
|
57
|
+
const parser = new parser_1.Parser(file || '<api>');
|
|
58
|
+
const program = parser.parse(source);
|
|
59
|
+
const hasErrors = parser.diagnostics.some(d => d.severity === 'error');
|
|
60
|
+
return {
|
|
61
|
+
ok: !hasErrors,
|
|
62
|
+
program: hasErrors ? null : program,
|
|
63
|
+
diagnostics: parser.diagnostics,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Verifica sintaxis y bien-formación sin ejecutar comandos lógicos.
|
|
68
|
+
* Parsea el código y reporta errores.
|
|
69
|
+
*/
|
|
70
|
+
function check(source, file) {
|
|
71
|
+
const parser = new parser_1.Parser(file || '<api>');
|
|
72
|
+
parser.parse(source);
|
|
73
|
+
const hasErrors = parser.diagnostics.some(d => d.severity === 'error');
|
|
74
|
+
return {
|
|
75
|
+
ok: !hasErrors,
|
|
76
|
+
diagnostics: parser.diagnostics,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Evalúa una expresión lógica rápida (auto-prepone "logic classical.propositional").
|
|
81
|
+
* Útil para validaciones inline sin necesidad de declarar perfil.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```ts
|
|
85
|
+
* const r = quickEval('check valid (P -> (Q -> P))');
|
|
86
|
+
* console.log(r.ok); // true
|
|
87
|
+
* console.log(r.results[0].status); // 'valid'
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function quickEval(expression) {
|
|
91
|
+
return evaluate(`logic classical.propositional\n${expression}`);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Crea una instancia de intérprete ST con estado persistente.
|
|
95
|
+
*/
|
|
96
|
+
function createInterpreter() {
|
|
97
|
+
const inner = new interpreter_1.Interpreter();
|
|
98
|
+
const history = [];
|
|
99
|
+
return {
|
|
100
|
+
exec(source) {
|
|
101
|
+
const output = inner.executeSingle(source);
|
|
102
|
+
const result = {
|
|
103
|
+
ok: output.exitCode === 0,
|
|
104
|
+
stdout: output.stdout,
|
|
105
|
+
stderr: output.stderr,
|
|
106
|
+
exitCode: output.exitCode,
|
|
107
|
+
results: output.results,
|
|
108
|
+
diagnostics: output.diagnostics,
|
|
109
|
+
};
|
|
110
|
+
history.push(result);
|
|
111
|
+
return result;
|
|
112
|
+
},
|
|
113
|
+
reset() {
|
|
114
|
+
inner.reset();
|
|
115
|
+
history.length = 0;
|
|
116
|
+
},
|
|
117
|
+
getProfile() {
|
|
118
|
+
const p = inner.getProfile();
|
|
119
|
+
return p ? p.name : null;
|
|
120
|
+
},
|
|
121
|
+
getAxioms() {
|
|
122
|
+
return Array.from(inner.getTheory().axioms.keys());
|
|
123
|
+
},
|
|
124
|
+
getTheorems() {
|
|
125
|
+
return Array.from(inner.getTheory().theorems.keys());
|
|
126
|
+
},
|
|
127
|
+
getClaims() {
|
|
128
|
+
return Array.from(inner.getTheory().claims.keys());
|
|
129
|
+
},
|
|
130
|
+
getTheorySummary() {
|
|
131
|
+
const t = inner.getTheory();
|
|
132
|
+
return {
|
|
133
|
+
profile: t.profile,
|
|
134
|
+
axioms: Array.from(t.axioms.keys()),
|
|
135
|
+
theorems: Array.from(t.theorems.keys()),
|
|
136
|
+
claims: Array.from(t.claims.keys()),
|
|
137
|
+
judgmentCount: t.judgments.length,
|
|
138
|
+
};
|
|
139
|
+
},
|
|
140
|
+
getHistory() {
|
|
141
|
+
return [...history];
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
// ── Utilidades expuestas ──────────────────────────────────────
|
|
146
|
+
/** Convierte una fórmula AST a string legible */
|
|
147
|
+
var propositional_1 = require("./profiles/classical/propositional");
|
|
148
|
+
Object.defineProperty(exports, "formulaToString", { enumerable: true, get: function () { return propositional_1.formulaToString; } });
|
|
149
|
+
/** Lista los perfiles lógicos disponibles */
|
|
150
|
+
function listProfiles() {
|
|
151
|
+
// Los perfiles se registran al crear un Interpreter
|
|
152
|
+
const temp = new interpreter_1.Interpreter();
|
|
153
|
+
void temp; // asegura registro de perfiles
|
|
154
|
+
const { registry } = require('./profiles/interface');
|
|
155
|
+
return registry.list();
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Obtiene información de hover para una posición en el código ST.
|
|
159
|
+
* Útil para tooltips en editores.
|
|
160
|
+
*
|
|
161
|
+
* @returns HoverInfo o null si no hay info en esa posición
|
|
162
|
+
*/
|
|
163
|
+
function hover(source, line, column, file) {
|
|
164
|
+
const handler = new handler_1.ProtocolHandler();
|
|
165
|
+
const resp = handler.handle({
|
|
166
|
+
id: 0,
|
|
167
|
+
method: 'hover',
|
|
168
|
+
params: { source, line, column, file: file || '<api>' }
|
|
169
|
+
});
|
|
170
|
+
return resp.result ?? null;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Lista todos los símbolos definidos en el código ST (axiomas, teoremas, claims, passages, etc.).
|
|
174
|
+
* Útil para panel de símbolos en editores.
|
|
175
|
+
*/
|
|
176
|
+
function symbols(source, file) {
|
|
177
|
+
const handler = new handler_1.ProtocolHandler();
|
|
178
|
+
const resp = handler.handle({
|
|
179
|
+
id: 0,
|
|
180
|
+
method: 'symbols',
|
|
181
|
+
params: { source, file: file || '<api>' }
|
|
182
|
+
});
|
|
183
|
+
return resp.result ?? [];
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Busca la definición de un símbolo por nombre en el código ST.
|
|
187
|
+
* Útil para "Go to Definition" en editores.
|
|
188
|
+
*
|
|
189
|
+
* @returns SourceLocation de la definición o null si no se encuentra
|
|
190
|
+
*/
|
|
191
|
+
function gotoDefinition(source, name, file) {
|
|
192
|
+
const handler = new handler_1.ProtocolHandler();
|
|
193
|
+
const resp = handler.handle({
|
|
194
|
+
id: 0,
|
|
195
|
+
method: 'goto_definition',
|
|
196
|
+
params: { source, name, file: file || '<api>' }
|
|
197
|
+
});
|
|
198
|
+
return resp.result ?? null;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Obtiene sugerencias de completado para el lenguaje ST.
|
|
202
|
+
* Devuelve keywords y snippets disponibles.
|
|
203
|
+
*/
|
|
204
|
+
function completion() {
|
|
205
|
+
const handler = new handler_1.ProtocolHandler();
|
|
206
|
+
const resp = handler.handle({
|
|
207
|
+
id: 0,
|
|
208
|
+
method: 'completion',
|
|
209
|
+
params: {}
|
|
210
|
+
});
|
|
211
|
+
return resp.result ?? [];
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Ejecuta y renderiza el código ST en el formato especificado.
|
|
215
|
+
*
|
|
216
|
+
* @param format 'markdown' | 'json' (default: 'markdown')
|
|
217
|
+
*/
|
|
218
|
+
function render(source, format, file) {
|
|
219
|
+
const handler = new handler_1.ProtocolHandler();
|
|
220
|
+
const resp = handler.handle({
|
|
221
|
+
id: 0,
|
|
222
|
+
method: 'render',
|
|
223
|
+
params: { source, format: format || 'markdown', file: file || '<api>' }
|
|
224
|
+
});
|
|
225
|
+
const result = resp.result;
|
|
226
|
+
return {
|
|
227
|
+
rendered: result?.rendered ?? '',
|
|
228
|
+
format: result?.format ?? format ?? 'markdown',
|
|
229
|
+
diagnostics: resp.diagnostics ?? [],
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,+CAA+C;AAC/C,+DAA+D;AAC/D,OAAO;AACP,6EAA6E;AAC7E,oFAAoF;AACpF,+DAA+D;;;AAuE/D,4BAWC;AAKD,sBASC;AAMD,sBAQC;AAaD,8BAEC;AAiDD,8CAwDC;AAQD,oCAMC;AAuBD,sBAQC;AAMD,0BAQC;AAQD,wCAQC;AAMD,gCAQC;AAOD,wBAaC;AAjVD,4CAAyC;AACzC,uDAAoD;AACpD,gDAAqD;AAkDrD,iEAAiE;AAEjE;;;;;;;;;;;;;;GAcG;AACH,SAAgB,QAAQ,CAAC,MAAc,EAAE,IAAa;IACpD,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAC;IACtC,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,IAAI,OAAO,CAAC,CAAC;IAC5D,OAAO;QACL,EAAE,EAAE,MAAM,CAAC,QAAQ,KAAK,CAAC;QACzB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,MAAM,CAAC,WAAW;KAChC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,KAAK,CAAC,MAAc,EAAE,IAAa;IACjD,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,IAAI,OAAO,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACr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
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Formula, SourceLocation } from '../types';
|
|
2
|
+
export type StatementKind = 'logic_decl' | 'axiom_decl' | 'theorem_decl' | 'derive_cmd' | 'check_valid_cmd' | 'check_satisfiable_cmd' | 'check_equivalent_cmd' | 'prove_cmd' | 'countermodel_cmd' | 'truth_table_cmd' | 'let_decl' | 'claim_decl' | 'support_decl' | 'confidence_decl' | 'context_decl' | 'render_cmd';
|
|
3
|
+
export interface ASTNode {
|
|
4
|
+
kind: StatementKind;
|
|
5
|
+
source: SourceLocation;
|
|
6
|
+
}
|
|
7
|
+
export interface LogicDeclNode extends ASTNode {
|
|
8
|
+
kind: 'logic_decl';
|
|
9
|
+
profile: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AxiomDeclNode extends ASTNode {
|
|
12
|
+
kind: 'axiom_decl';
|
|
13
|
+
name: string;
|
|
14
|
+
formula: Formula;
|
|
15
|
+
}
|
|
16
|
+
export interface TheoremDeclNode extends ASTNode {
|
|
17
|
+
kind: 'theorem_decl';
|
|
18
|
+
name: string;
|
|
19
|
+
formula: Formula;
|
|
20
|
+
}
|
|
21
|
+
export interface DeriveCmdNode extends ASTNode {
|
|
22
|
+
kind: 'derive_cmd';
|
|
23
|
+
goal: Formula;
|
|
24
|
+
premises: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface CheckValidCmdNode extends ASTNode {
|
|
27
|
+
kind: 'check_valid_cmd';
|
|
28
|
+
formula: Formula;
|
|
29
|
+
}
|
|
30
|
+
export interface CheckSatisfiableCmdNode extends ASTNode {
|
|
31
|
+
kind: 'check_satisfiable_cmd';
|
|
32
|
+
formula: Formula;
|
|
33
|
+
}
|
|
34
|
+
export interface CheckEquivalentCmdNode extends ASTNode {
|
|
35
|
+
kind: 'check_equivalent_cmd';
|
|
36
|
+
left: Formula;
|
|
37
|
+
right: Formula;
|
|
38
|
+
}
|
|
39
|
+
export interface ProveCmdNode extends ASTNode {
|
|
40
|
+
kind: 'prove_cmd';
|
|
41
|
+
goal: Formula;
|
|
42
|
+
premises: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface CountermodelCmdNode extends ASTNode {
|
|
45
|
+
kind: 'countermodel_cmd';
|
|
46
|
+
formula: Formula;
|
|
47
|
+
}
|
|
48
|
+
export interface TruthTableCmdNode extends ASTNode {
|
|
49
|
+
kind: 'truth_table_cmd';
|
|
50
|
+
formula: Formula;
|
|
51
|
+
}
|
|
52
|
+
export interface RenderCmdNode extends ASTNode {
|
|
53
|
+
kind: 'render_cmd';
|
|
54
|
+
target: string;
|
|
55
|
+
format: string;
|
|
56
|
+
}
|
|
57
|
+
export interface LetPassageNode extends ASTNode {
|
|
58
|
+
kind: 'let_decl';
|
|
59
|
+
name: string;
|
|
60
|
+
letType: 'passage';
|
|
61
|
+
anchorPath: string;
|
|
62
|
+
}
|
|
63
|
+
export interface LetFormalizeNode extends ASTNode {
|
|
64
|
+
kind: 'let_decl';
|
|
65
|
+
name: string;
|
|
66
|
+
letType: 'formalize';
|
|
67
|
+
passageName: string;
|
|
68
|
+
formula: Formula;
|
|
69
|
+
}
|
|
70
|
+
export type LetDeclNode = LetPassageNode | LetFormalizeNode;
|
|
71
|
+
export interface ClaimDeclNode extends ASTNode {
|
|
72
|
+
kind: 'claim_decl';
|
|
73
|
+
name: string;
|
|
74
|
+
value: string;
|
|
75
|
+
formula?: Formula;
|
|
76
|
+
}
|
|
77
|
+
export interface SupportDeclNode extends ASTNode {
|
|
78
|
+
kind: 'support_decl';
|
|
79
|
+
claimName: string;
|
|
80
|
+
sourceName: string;
|
|
81
|
+
}
|
|
82
|
+
export interface ConfidenceDeclNode extends ASTNode {
|
|
83
|
+
kind: 'confidence_decl';
|
|
84
|
+
claimName: string;
|
|
85
|
+
value: number;
|
|
86
|
+
}
|
|
87
|
+
export interface ContextDeclNode extends ASTNode {
|
|
88
|
+
kind: 'context_decl';
|
|
89
|
+
claimName: string;
|
|
90
|
+
text: string;
|
|
91
|
+
}
|
|
92
|
+
export type Statement = LogicDeclNode | AxiomDeclNode | TheoremDeclNode | DeriveCmdNode | CheckValidCmdNode | CheckSatisfiableCmdNode | CheckEquivalentCmdNode | ProveCmdNode | CountermodelCmdNode | TruthTableCmdNode | LetDeclNode | ClaimDeclNode | SupportDeclNode | ConfidenceDeclNode | ContextDeclNode | RenderCmdNode;
|
|
93
|
+
export interface Program {
|
|
94
|
+
statements: Statement[];
|
|
95
|
+
file: string;
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/ast/nodes.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAInD,MAAM,MAAM,aAAa,GACrB,YAAY,GACZ,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,iBAAiB,GACjB,uBAAuB,GACvB,sBAAsB,GACtB,WAAW,GACX,kBAAkB,GAClB,iBAAiB,GACjB,UAAU,GACV,YAAY,GACZ,cAAc,GACd,iBAAiB,GACjB,cAAc,GACd,YAAY,CAAC;AAEjB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;CACxB;AAID,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,IAAI,EAAE,cAAc,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB;AAID,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C,IAAI,EAAE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,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,WAAW,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAE5D,MAAM,WAAW,aAAc,SAAQ,OAAO;IAC5C,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,kBAAmB,SAAQ,OAAO;IACjD,IAAI,EAAE,iBAAiB,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAgB,SAAQ,OAAO;IAC9C,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAID,MAAM,MAAM,SAAS,GACjB,aAAa,GACb,aAAa,GACb,eAAe,GACf,aAAa,GACb,iBAAiB,GACjB,uBAAuB,GACvB,sBAAsB,GACtB,YAAY,GACZ,mBAAmB,GACnB,iBAAiB,GACjB,WAAW,GACX,aAAa,GACb,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,aAAa,CAAC;AAElB,MAAM,WAAW,OAAO;IACtB,UAAU,EAAE,SAAS,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================
|
|
3
|
+
// ST AST — Nodos del Árbol de Sintaxis Abstracta
|
|
4
|
+
// ============================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
//# sourceMappingURL=nodes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/ast/nodes.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,iDAAiD;AACjD,+DAA+D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|