@manifesto-ai/compiler 1.7.0 → 1.8.1
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 +3 -2
- package/dist/{chunk-QP2LGMBA.js → chunk-4JJQCFJH.js} +4381 -1272
- package/dist/chunk-4JJQCFJH.js.map +1 -0
- package/dist/{chunk-QXLPDCLA.js → chunk-AYZTDA3J.js} +2 -2
- package/dist/{chunk-DJY6BFGK.js → chunk-K4IKHGOP.js} +3 -3
- package/dist/esbuild.js +3 -3
- package/dist/index.d.ts +282 -177
- package/dist/index.js +394 -158
- package/dist/index.js.map +1 -1
- package/dist/node-loader.js +2 -2
- package/dist/rollup.js +3 -3
- package/dist/rspack.js +3 -3
- package/dist/vite.js +3 -3
- package/dist/webpack.js +3 -3
- package/package.json +6 -6
- package/dist/chunk-QP2LGMBA.js.map +0 -1
- /package/dist/{chunk-QXLPDCLA.js.map → chunk-AYZTDA3J.js.map} +0 -0
- /package/dist/{chunk-DJY6BFGK.js.map → chunk-K4IKHGOP.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
compileMelDomain
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4JJQCFJH.js";
|
|
4
4
|
|
|
5
5
|
// src/mel-module.ts
|
|
6
6
|
function formatDiagnostic(diagnostic) {
|
|
@@ -30,4 +30,4 @@ export {
|
|
|
30
30
|
formatDiagnostic,
|
|
31
31
|
compileMelToModuleCode
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-AYZTDA3J.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatDiagnostic
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AYZTDA3J.js";
|
|
4
4
|
import {
|
|
5
5
|
compileMelDomain
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4JJQCFJH.js";
|
|
7
7
|
|
|
8
8
|
// src/unplugin.ts
|
|
9
9
|
import { createUnplugin } from "unplugin";
|
|
@@ -71,4 +71,4 @@ ${details}`);
|
|
|
71
71
|
export {
|
|
72
72
|
unpluginMel
|
|
73
73
|
};
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-K4IKHGOP.js.map
|
package/dist/esbuild.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
unpluginMel
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-K4IKHGOP.js";
|
|
4
|
+
import "./chunk-AYZTDA3J.js";
|
|
5
|
+
import "./chunk-4JJQCFJH.js";
|
|
6
6
|
|
|
7
7
|
// src/esbuild.ts
|
|
8
8
|
var melPlugin = unpluginMel.esbuild;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ExprNode as ExprNode$2, PatchPath, Patch } from '@manifesto-ai/core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Source Location Types
|
|
@@ -253,7 +253,7 @@ interface DomainNode extends ASTNode {
|
|
|
253
253
|
/**
|
|
254
254
|
* Domain member types
|
|
255
255
|
*/
|
|
256
|
-
type DomainMember = StateNode | ComputedNode | ActionNode;
|
|
256
|
+
type DomainMember = StateNode | ComputedNode | ActionNode | FlowDeclNode;
|
|
257
257
|
/**
|
|
258
258
|
* Type declaration (v0.3.3)
|
|
259
259
|
* Syntax: type Name = TypeExpr
|
|
@@ -298,6 +298,16 @@ interface ActionNode extends ASTNode {
|
|
|
298
298
|
available?: ExprNode$1;
|
|
299
299
|
body: GuardedStmtNode[];
|
|
300
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* Flow declaration (v0.7.0 / ADR-013a)
|
|
303
|
+
* Raw AST preserves flow declarations until the expansion pass removes them.
|
|
304
|
+
*/
|
|
305
|
+
interface FlowDeclNode extends ASTNode {
|
|
306
|
+
kind: "flow";
|
|
307
|
+
name: string;
|
|
308
|
+
params: ParamNode[];
|
|
309
|
+
body: FlowStmtNode[];
|
|
310
|
+
}
|
|
301
311
|
/**
|
|
302
312
|
* Parameter declaration
|
|
303
313
|
*/
|
|
@@ -309,11 +319,16 @@ interface ParamNode extends ASTNode {
|
|
|
309
319
|
/**
|
|
310
320
|
* Guarded statement types (top-level in action body)
|
|
311
321
|
*/
|
|
312
|
-
type GuardedStmtNode = WhenStmtNode | OnceStmtNode | OnceIntentStmtNode;
|
|
322
|
+
type GuardedStmtNode = WhenStmtNode | OnceStmtNode | OnceIntentStmtNode | IncludeStmtNode | FailStmtNode | StopStmtNode;
|
|
323
|
+
/**
|
|
324
|
+
* Raw flow statement types (top-level in flow body).
|
|
325
|
+
* Parser stays permissive; validation narrows the allowed subset.
|
|
326
|
+
*/
|
|
327
|
+
type FlowStmtNode = WhenStmtNode | IncludeStmtNode | OnceStmtNode | OnceIntentStmtNode | PatchStmtNode | EffectStmtNode;
|
|
313
328
|
/**
|
|
314
329
|
* Inner statement types (inside guards)
|
|
315
330
|
*/
|
|
316
|
-
type InnerStmtNode = PatchStmtNode | EffectStmtNode | WhenStmtNode | OnceStmtNode | OnceIntentStmtNode | FailStmtNode | StopStmtNode;
|
|
331
|
+
type InnerStmtNode = PatchStmtNode | EffectStmtNode | WhenStmtNode | OnceStmtNode | OnceIntentStmtNode | IncludeStmtNode | FailStmtNode | StopStmtNode;
|
|
317
332
|
/**
|
|
318
333
|
* When guard statement
|
|
319
334
|
*/
|
|
@@ -339,6 +354,15 @@ interface OnceIntentStmtNode extends ASTNode {
|
|
|
339
354
|
condition?: ExprNode$1;
|
|
340
355
|
body: InnerStmtNode[];
|
|
341
356
|
}
|
|
357
|
+
/**
|
|
358
|
+
* Include statement (v0.7.0 / ADR-013a)
|
|
359
|
+
* Raw AST preserves include sites until the expansion pass inlines them.
|
|
360
|
+
*/
|
|
361
|
+
interface IncludeStmtNode extends ASTNode {
|
|
362
|
+
kind: "include";
|
|
363
|
+
flowName: string;
|
|
364
|
+
args: ExprNode$1[];
|
|
365
|
+
}
|
|
342
366
|
/**
|
|
343
367
|
* Patch statement
|
|
344
368
|
*/
|
|
@@ -638,8 +662,10 @@ declare class Parser {
|
|
|
638
662
|
private parseStateField;
|
|
639
663
|
private parseComputed;
|
|
640
664
|
private parseAction;
|
|
665
|
+
private parseFlowDecl;
|
|
641
666
|
private parseParam;
|
|
642
667
|
private parseGuardedStmt;
|
|
668
|
+
private parseFlowStmt;
|
|
643
669
|
/**
|
|
644
670
|
* Skip tokens until we reach a recovery point (closing brace, guard keyword, or EOF).
|
|
645
671
|
*/
|
|
@@ -648,6 +674,7 @@ declare class Parser {
|
|
|
648
674
|
private parseOnceStmt;
|
|
649
675
|
private parseOnceIntentStmt;
|
|
650
676
|
private parseInnerStmt;
|
|
677
|
+
private parseIncludeStmt;
|
|
651
678
|
private parsePatchStmt;
|
|
652
679
|
private parseEffectStmt;
|
|
653
680
|
private parseEffectArg;
|
|
@@ -679,11 +706,14 @@ declare class Parser {
|
|
|
679
706
|
private isUnaryContext;
|
|
680
707
|
private peek;
|
|
681
708
|
private peekNext;
|
|
709
|
+
private peekAt;
|
|
682
710
|
private previous;
|
|
683
711
|
private isAtEnd;
|
|
684
712
|
private advance;
|
|
685
713
|
private check;
|
|
686
714
|
private isOnceIntentContext;
|
|
715
|
+
private isFlowDeclContext;
|
|
716
|
+
private isIncludeContext;
|
|
687
717
|
private match;
|
|
688
718
|
private consume;
|
|
689
719
|
private error;
|
|
@@ -787,6 +817,7 @@ interface ValidationResult {
|
|
|
787
817
|
*/
|
|
788
818
|
declare class SemanticValidator {
|
|
789
819
|
private ctx;
|
|
820
|
+
private symbols;
|
|
790
821
|
/**
|
|
791
822
|
* Validate a MEL program
|
|
792
823
|
*/
|
|
@@ -800,6 +831,7 @@ declare class SemanticValidator {
|
|
|
800
831
|
* v0.3.3: Validate state field - check for anonymous object types (W012)
|
|
801
832
|
*/
|
|
802
833
|
private validateStateField;
|
|
834
|
+
private validateStateInitializer;
|
|
803
835
|
/**
|
|
804
836
|
* v0.3.3: Check if a type expression contains anonymous object types
|
|
805
837
|
* Issues W012 warning for inline object types in state fields
|
|
@@ -817,9 +849,17 @@ declare class SemanticValidator {
|
|
|
817
849
|
private validateOnceIntent;
|
|
818
850
|
private validatePatch;
|
|
819
851
|
private validateEffect;
|
|
852
|
+
private validateFail;
|
|
853
|
+
private validateStop;
|
|
820
854
|
private validateCondition;
|
|
821
855
|
private validateExpr;
|
|
822
856
|
private validateFunctionCall;
|
|
857
|
+
private validatePrimitiveEquality;
|
|
858
|
+
private inferType;
|
|
859
|
+
private requireAssignable;
|
|
860
|
+
private requireArrayCompatible;
|
|
861
|
+
private requireLenCompatible;
|
|
862
|
+
private validateCoalesceTypes;
|
|
823
863
|
private error;
|
|
824
864
|
private warn;
|
|
825
865
|
}
|
|
@@ -879,6 +919,181 @@ declare function formatDiagnostic(diagnostic: Diagnostic, source?: string): stri
|
|
|
879
919
|
*/
|
|
880
920
|
declare function formatDiagnostics(diagnostics: Diagnostic[], source?: string): string;
|
|
881
921
|
|
|
922
|
+
/**
|
|
923
|
+
* Lowering Context Types
|
|
924
|
+
*
|
|
925
|
+
* Defines contexts for expression and patch lowering.
|
|
926
|
+
*
|
|
927
|
+
* @see SPEC v0.4.0 §17.2
|
|
928
|
+
*/
|
|
929
|
+
/**
|
|
930
|
+
* Allowed system path prefixes.
|
|
931
|
+
*
|
|
932
|
+
* In Translator path, only 'meta' and 'input' are allowed.
|
|
933
|
+
* 'system' is forbidden (requires Flow execution).
|
|
934
|
+
*
|
|
935
|
+
* @see FDR-MEL-071
|
|
936
|
+
*/
|
|
937
|
+
type AllowedSysPrefix = "meta" | "input";
|
|
938
|
+
/**
|
|
939
|
+
* Context for single expression lowering.
|
|
940
|
+
*
|
|
941
|
+
* @see SPEC v0.4.0 §17.2
|
|
942
|
+
*/
|
|
943
|
+
interface ExprLoweringContext {
|
|
944
|
+
/**
|
|
945
|
+
* Expression context mode.
|
|
946
|
+
* - 'schema': for addComputed, addConstraint, etc.
|
|
947
|
+
* - 'action': for guards, patches, effects
|
|
948
|
+
*/
|
|
949
|
+
mode: "schema" | "action";
|
|
950
|
+
/**
|
|
951
|
+
* Allowed system path prefixes.
|
|
952
|
+
* In Translator path: only ["meta", "input"]
|
|
953
|
+
*
|
|
954
|
+
* @see FDR-MEL-071
|
|
955
|
+
*/
|
|
956
|
+
allowSysPaths?: {
|
|
957
|
+
prefixes: AllowedSysPrefix[];
|
|
958
|
+
};
|
|
959
|
+
/**
|
|
960
|
+
* Function table version for call lowering.
|
|
961
|
+
*/
|
|
962
|
+
fnTableVersion: string;
|
|
963
|
+
/**
|
|
964
|
+
* Action name (for action context).
|
|
965
|
+
*/
|
|
966
|
+
actionName?: string;
|
|
967
|
+
/**
|
|
968
|
+
* Whether $item is allowed in this context.
|
|
969
|
+
* Only true for effect.args fields.
|
|
970
|
+
*
|
|
971
|
+
* @see FDR-MEL-068
|
|
972
|
+
*/
|
|
973
|
+
allowItem?: boolean;
|
|
974
|
+
}
|
|
975
|
+
/**
|
|
976
|
+
* Context for patch lowering.
|
|
977
|
+
*
|
|
978
|
+
* NO mode field - Compiler determines context per op-field.
|
|
979
|
+
*
|
|
980
|
+
* @see SPEC v0.4.0 §17.2, AD-COMP-LOW-002
|
|
981
|
+
*/
|
|
982
|
+
interface PatchLoweringContext {
|
|
983
|
+
/**
|
|
984
|
+
* Allowed system path prefixes.
|
|
985
|
+
* In Translator path: only ["meta", "input"]
|
|
986
|
+
*
|
|
987
|
+
* @see FDR-MEL-071
|
|
988
|
+
*/
|
|
989
|
+
allowSysPaths?: {
|
|
990
|
+
prefixes: AllowedSysPrefix[];
|
|
991
|
+
};
|
|
992
|
+
/**
|
|
993
|
+
* Function table version for call lowering.
|
|
994
|
+
*/
|
|
995
|
+
fnTableVersion: string;
|
|
996
|
+
/**
|
|
997
|
+
* Action name (for action-related ops).
|
|
998
|
+
*/
|
|
999
|
+
actionName?: string;
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Default expression lowering context for schema mode.
|
|
1003
|
+
*/
|
|
1004
|
+
declare const DEFAULT_SCHEMA_CONTEXT: ExprLoweringContext;
|
|
1005
|
+
/**
|
|
1006
|
+
* Default expression lowering context for action mode.
|
|
1007
|
+
*/
|
|
1008
|
+
declare const DEFAULT_ACTION_CONTEXT: ExprLoweringContext;
|
|
1009
|
+
/**
|
|
1010
|
+
* Context for effect.args (allows $item).
|
|
1011
|
+
*/
|
|
1012
|
+
declare const EFFECT_ARGS_CONTEXT: ExprLoweringContext;
|
|
1013
|
+
/**
|
|
1014
|
+
* Default patch lowering context.
|
|
1015
|
+
*/
|
|
1016
|
+
declare const DEFAULT_PATCH_CONTEXT: PatchLoweringContext;
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Expression Lowering
|
|
1020
|
+
*
|
|
1021
|
+
* Transforms MEL Canonical IR (8 kinds) to Core Runtime IR (30+ kinds).
|
|
1022
|
+
*
|
|
1023
|
+
* @see SPEC v0.4.0 §17
|
|
1024
|
+
*/
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* MEL primitive value.
|
|
1028
|
+
*/
|
|
1029
|
+
type MelPrimitive = null | boolean | number | string;
|
|
1030
|
+
/**
|
|
1031
|
+
* MEL path segment.
|
|
1032
|
+
*/
|
|
1033
|
+
type MelPathSegment = {
|
|
1034
|
+
kind: "prop";
|
|
1035
|
+
name: string;
|
|
1036
|
+
};
|
|
1037
|
+
/**
|
|
1038
|
+
* MEL path node array.
|
|
1039
|
+
*/
|
|
1040
|
+
type MelPathNode = MelPathSegment[];
|
|
1041
|
+
/**
|
|
1042
|
+
* MEL system path as segment array.
|
|
1043
|
+
*/
|
|
1044
|
+
type MelSystemPath = string[];
|
|
1045
|
+
/**
|
|
1046
|
+
* MEL object field.
|
|
1047
|
+
*/
|
|
1048
|
+
type MelObjField = {
|
|
1049
|
+
key: string;
|
|
1050
|
+
value: MelExprNode;
|
|
1051
|
+
};
|
|
1052
|
+
/**
|
|
1053
|
+
* MEL Canonical IR (8 kinds).
|
|
1054
|
+
*
|
|
1055
|
+
* @see SPEC v0.4.0 §17.1.1
|
|
1056
|
+
*/
|
|
1057
|
+
type MelExprNode = {
|
|
1058
|
+
kind: "lit";
|
|
1059
|
+
value: MelPrimitive;
|
|
1060
|
+
} | {
|
|
1061
|
+
kind: "var";
|
|
1062
|
+
name: "item";
|
|
1063
|
+
} | {
|
|
1064
|
+
kind: "sys";
|
|
1065
|
+
path: MelSystemPath;
|
|
1066
|
+
} | {
|
|
1067
|
+
kind: "get";
|
|
1068
|
+
base?: MelExprNode;
|
|
1069
|
+
path: MelPathNode;
|
|
1070
|
+
} | {
|
|
1071
|
+
kind: "field";
|
|
1072
|
+
object: MelExprNode;
|
|
1073
|
+
property: string;
|
|
1074
|
+
} | {
|
|
1075
|
+
kind: "call";
|
|
1076
|
+
fn: string;
|
|
1077
|
+
args: MelExprNode[];
|
|
1078
|
+
} | {
|
|
1079
|
+
kind: "obj";
|
|
1080
|
+
fields: MelObjField[];
|
|
1081
|
+
} | {
|
|
1082
|
+
kind: "arr";
|
|
1083
|
+
elements: MelExprNode[];
|
|
1084
|
+
};
|
|
1085
|
+
/**
|
|
1086
|
+
* Lower MEL expression to Core expression.
|
|
1087
|
+
*
|
|
1088
|
+
* @param input - MEL canonical IR expression
|
|
1089
|
+
* @param ctx - Lowering context
|
|
1090
|
+
* @returns Core runtime IR expression
|
|
1091
|
+
* @throws LoweringError if expression cannot be lowered
|
|
1092
|
+
*
|
|
1093
|
+
* @see SPEC v0.4.0 §17.3
|
|
1094
|
+
*/
|
|
1095
|
+
declare function lowerExprNode(input: MelExprNode, ctx: ExprLoweringContext): ExprNode$2;
|
|
1096
|
+
|
|
882
1097
|
/**
|
|
883
1098
|
* IR Generator - Transforms MEL AST to Core DomainSchema
|
|
884
1099
|
* Based on MEL SPEC v0.3.3 Section 5
|
|
@@ -1086,6 +1301,7 @@ type CoreExprNode = {
|
|
|
1086
1301
|
kind: "toString";
|
|
1087
1302
|
arg: CoreExprNode;
|
|
1088
1303
|
};
|
|
1304
|
+
type CompilerExprNode = MelExprNode;
|
|
1089
1305
|
/**
|
|
1090
1306
|
* Core FlowNode types (matching core/schema/flow.ts)
|
|
1091
1307
|
*/
|
|
@@ -1117,6 +1333,34 @@ type CoreFlowNode = {
|
|
|
1117
1333
|
code: string;
|
|
1118
1334
|
message?: CoreExprNode;
|
|
1119
1335
|
};
|
|
1336
|
+
type CompilerFlowNode = {
|
|
1337
|
+
kind: "seq";
|
|
1338
|
+
steps: CompilerFlowNode[];
|
|
1339
|
+
} | {
|
|
1340
|
+
kind: "if";
|
|
1341
|
+
cond: CompilerExprNode;
|
|
1342
|
+
then: CompilerFlowNode;
|
|
1343
|
+
else?: CompilerFlowNode;
|
|
1344
|
+
} | {
|
|
1345
|
+
kind: "patch";
|
|
1346
|
+
op: "set" | "unset" | "merge";
|
|
1347
|
+
path: PatchPath;
|
|
1348
|
+
value?: CompilerExprNode;
|
|
1349
|
+
} | {
|
|
1350
|
+
kind: "effect";
|
|
1351
|
+
type: string;
|
|
1352
|
+
params: Record<string, CompilerExprNode>;
|
|
1353
|
+
} | {
|
|
1354
|
+
kind: "call";
|
|
1355
|
+
flow: string;
|
|
1356
|
+
} | {
|
|
1357
|
+
kind: "halt";
|
|
1358
|
+
reason?: string;
|
|
1359
|
+
} | {
|
|
1360
|
+
kind: "fail";
|
|
1361
|
+
code: string;
|
|
1362
|
+
message?: CompilerExprNode;
|
|
1363
|
+
};
|
|
1120
1364
|
/**
|
|
1121
1365
|
* Field type definition
|
|
1122
1366
|
*/
|
|
@@ -1148,6 +1392,11 @@ interface ComputedFieldSpec {
|
|
|
1148
1392
|
expr: CoreExprNode;
|
|
1149
1393
|
description?: string;
|
|
1150
1394
|
}
|
|
1395
|
+
interface CompilerComputedFieldSpec {
|
|
1396
|
+
deps: string[];
|
|
1397
|
+
expr: CompilerExprNode;
|
|
1398
|
+
description?: string;
|
|
1399
|
+
}
|
|
1151
1400
|
/**
|
|
1152
1401
|
* Computed specification
|
|
1153
1402
|
*/
|
|
@@ -1163,6 +1412,12 @@ interface ActionSpec {
|
|
|
1163
1412
|
available?: CoreExprNode;
|
|
1164
1413
|
description?: string;
|
|
1165
1414
|
}
|
|
1415
|
+
interface CompilerActionSpec {
|
|
1416
|
+
flow: CompilerFlowNode;
|
|
1417
|
+
input?: FieldSpec;
|
|
1418
|
+
available?: CompilerExprNode;
|
|
1419
|
+
description?: string;
|
|
1420
|
+
}
|
|
1166
1421
|
/**
|
|
1167
1422
|
* Domain schema (output IR)
|
|
1168
1423
|
*/
|
|
@@ -1217,12 +1472,33 @@ interface DomainSchema {
|
|
|
1217
1472
|
authors?: string[];
|
|
1218
1473
|
};
|
|
1219
1474
|
}
|
|
1475
|
+
interface CanonicalDomainSchema {
|
|
1476
|
+
id: string;
|
|
1477
|
+
version: string;
|
|
1478
|
+
hash: string;
|
|
1479
|
+
types: Record<string, TypeSpec>;
|
|
1480
|
+
state: StateSpec;
|
|
1481
|
+
computed: {
|
|
1482
|
+
fields: Record<string, CompilerComputedFieldSpec>;
|
|
1483
|
+
};
|
|
1484
|
+
actions: Record<string, CompilerActionSpec>;
|
|
1485
|
+
meta?: {
|
|
1486
|
+
name?: string;
|
|
1487
|
+
description?: string;
|
|
1488
|
+
authors?: string[];
|
|
1489
|
+
};
|
|
1490
|
+
}
|
|
1220
1491
|
interface GenerateResult {
|
|
1221
1492
|
schema: DomainSchema | null;
|
|
1222
1493
|
diagnostics: Diagnostic[];
|
|
1223
1494
|
}
|
|
1495
|
+
interface GenerateCanonicalResult {
|
|
1496
|
+
schema: CanonicalDomainSchema | null;
|
|
1497
|
+
diagnostics: Diagnostic[];
|
|
1498
|
+
}
|
|
1499
|
+
declare function generateCanonical(program: ProgramNode): GenerateCanonicalResult;
|
|
1224
1500
|
/**
|
|
1225
|
-
* Generate
|
|
1501
|
+
* Generate runtime-ready DomainSchema from MEL AST.
|
|
1226
1502
|
*/
|
|
1227
1503
|
declare function generate(program: ProgramNode): GenerateResult;
|
|
1228
1504
|
|
|
@@ -1650,102 +1926,6 @@ declare function renderFragmentsByKind(fragments: PatchFragment[], options?: Fra
|
|
|
1650
1926
|
*/
|
|
1651
1927
|
declare function renderAsDomain(domainName: string, fragments: PatchFragment[], options?: FragmentRenderOptions): string;
|
|
1652
1928
|
|
|
1653
|
-
/**
|
|
1654
|
-
* Lowering Context Types
|
|
1655
|
-
*
|
|
1656
|
-
* Defines contexts for expression and patch lowering.
|
|
1657
|
-
*
|
|
1658
|
-
* @see SPEC v0.4.0 §17.2
|
|
1659
|
-
*/
|
|
1660
|
-
/**
|
|
1661
|
-
* Allowed system path prefixes.
|
|
1662
|
-
*
|
|
1663
|
-
* In Translator path, only 'meta' and 'input' are allowed.
|
|
1664
|
-
* 'system' is forbidden (requires Flow execution).
|
|
1665
|
-
*
|
|
1666
|
-
* @see FDR-MEL-071
|
|
1667
|
-
*/
|
|
1668
|
-
type AllowedSysPrefix = "meta" | "input";
|
|
1669
|
-
/**
|
|
1670
|
-
* Context for single expression lowering.
|
|
1671
|
-
*
|
|
1672
|
-
* @see SPEC v0.4.0 §17.2
|
|
1673
|
-
*/
|
|
1674
|
-
interface ExprLoweringContext {
|
|
1675
|
-
/**
|
|
1676
|
-
* Expression context mode.
|
|
1677
|
-
* - 'schema': for addComputed, addConstraint, etc.
|
|
1678
|
-
* - 'action': for guards, patches, effects
|
|
1679
|
-
*/
|
|
1680
|
-
mode: "schema" | "action";
|
|
1681
|
-
/**
|
|
1682
|
-
* Allowed system path prefixes.
|
|
1683
|
-
* In Translator path: only ["meta", "input"]
|
|
1684
|
-
*
|
|
1685
|
-
* @see FDR-MEL-071
|
|
1686
|
-
*/
|
|
1687
|
-
allowSysPaths?: {
|
|
1688
|
-
prefixes: AllowedSysPrefix[];
|
|
1689
|
-
};
|
|
1690
|
-
/**
|
|
1691
|
-
* Function table version for call lowering.
|
|
1692
|
-
*/
|
|
1693
|
-
fnTableVersion: string;
|
|
1694
|
-
/**
|
|
1695
|
-
* Action name (for action context).
|
|
1696
|
-
*/
|
|
1697
|
-
actionName?: string;
|
|
1698
|
-
/**
|
|
1699
|
-
* Whether $item is allowed in this context.
|
|
1700
|
-
* Only true for effect.args fields.
|
|
1701
|
-
*
|
|
1702
|
-
* @see FDR-MEL-068
|
|
1703
|
-
*/
|
|
1704
|
-
allowItem?: boolean;
|
|
1705
|
-
}
|
|
1706
|
-
/**
|
|
1707
|
-
* Context for patch lowering.
|
|
1708
|
-
*
|
|
1709
|
-
* NO mode field - Compiler determines context per op-field.
|
|
1710
|
-
*
|
|
1711
|
-
* @see SPEC v0.4.0 §17.2, AD-COMP-LOW-002
|
|
1712
|
-
*/
|
|
1713
|
-
interface PatchLoweringContext {
|
|
1714
|
-
/**
|
|
1715
|
-
* Allowed system path prefixes.
|
|
1716
|
-
* In Translator path: only ["meta", "input"]
|
|
1717
|
-
*
|
|
1718
|
-
* @see FDR-MEL-071
|
|
1719
|
-
*/
|
|
1720
|
-
allowSysPaths?: {
|
|
1721
|
-
prefixes: AllowedSysPrefix[];
|
|
1722
|
-
};
|
|
1723
|
-
/**
|
|
1724
|
-
* Function table version for call lowering.
|
|
1725
|
-
*/
|
|
1726
|
-
fnTableVersion: string;
|
|
1727
|
-
/**
|
|
1728
|
-
* Action name (for action-related ops).
|
|
1729
|
-
*/
|
|
1730
|
-
actionName?: string;
|
|
1731
|
-
}
|
|
1732
|
-
/**
|
|
1733
|
-
* Default expression lowering context for schema mode.
|
|
1734
|
-
*/
|
|
1735
|
-
declare const DEFAULT_SCHEMA_CONTEXT: ExprLoweringContext;
|
|
1736
|
-
/**
|
|
1737
|
-
* Default expression lowering context for action mode.
|
|
1738
|
-
*/
|
|
1739
|
-
declare const DEFAULT_ACTION_CONTEXT: ExprLoweringContext;
|
|
1740
|
-
/**
|
|
1741
|
-
* Context for effect.args (allows $item).
|
|
1742
|
-
*/
|
|
1743
|
-
declare const EFFECT_ARGS_CONTEXT: ExprLoweringContext;
|
|
1744
|
-
/**
|
|
1745
|
-
* Default patch lowering context.
|
|
1746
|
-
*/
|
|
1747
|
-
declare const DEFAULT_PATCH_CONTEXT: PatchLoweringContext;
|
|
1748
|
-
|
|
1749
1929
|
/**
|
|
1750
1930
|
* Lowering Error Types
|
|
1751
1931
|
*
|
|
@@ -1830,81 +2010,6 @@ declare function invalidShape(description: string, path?: string[]): LoweringErr
|
|
|
1830
2010
|
*/
|
|
1831
2011
|
declare function unknownNodeKind(kind: string, path?: string[]): LoweringError;
|
|
1832
2012
|
|
|
1833
|
-
/**
|
|
1834
|
-
* Expression Lowering
|
|
1835
|
-
*
|
|
1836
|
-
* Transforms MEL Canonical IR (7 kinds) to Core Runtime IR (30+ kinds).
|
|
1837
|
-
*
|
|
1838
|
-
* @see SPEC v0.4.0 §17
|
|
1839
|
-
*/
|
|
1840
|
-
|
|
1841
|
-
/**
|
|
1842
|
-
* MEL primitive value.
|
|
1843
|
-
*/
|
|
1844
|
-
type MelPrimitive = null | boolean | number | string;
|
|
1845
|
-
/**
|
|
1846
|
-
* MEL path segment.
|
|
1847
|
-
*/
|
|
1848
|
-
type MelPathSegment = {
|
|
1849
|
-
kind: "prop";
|
|
1850
|
-
name: string;
|
|
1851
|
-
};
|
|
1852
|
-
/**
|
|
1853
|
-
* MEL path node array.
|
|
1854
|
-
*/
|
|
1855
|
-
type MelPathNode = MelPathSegment[];
|
|
1856
|
-
/**
|
|
1857
|
-
* MEL system path as segment array.
|
|
1858
|
-
*/
|
|
1859
|
-
type MelSystemPath = string[];
|
|
1860
|
-
/**
|
|
1861
|
-
* MEL object field.
|
|
1862
|
-
*/
|
|
1863
|
-
type MelObjField = {
|
|
1864
|
-
key: string;
|
|
1865
|
-
value: MelExprNode;
|
|
1866
|
-
};
|
|
1867
|
-
/**
|
|
1868
|
-
* MEL Canonical IR (7 kinds).
|
|
1869
|
-
*
|
|
1870
|
-
* @see SPEC v0.4.0 §17.1.1
|
|
1871
|
-
*/
|
|
1872
|
-
type MelExprNode = {
|
|
1873
|
-
kind: "lit";
|
|
1874
|
-
value: MelPrimitive;
|
|
1875
|
-
} | {
|
|
1876
|
-
kind: "var";
|
|
1877
|
-
name: "item";
|
|
1878
|
-
} | {
|
|
1879
|
-
kind: "sys";
|
|
1880
|
-
path: MelSystemPath;
|
|
1881
|
-
} | {
|
|
1882
|
-
kind: "get";
|
|
1883
|
-
base?: MelExprNode;
|
|
1884
|
-
path: MelPathNode;
|
|
1885
|
-
} | {
|
|
1886
|
-
kind: "call";
|
|
1887
|
-
fn: string;
|
|
1888
|
-
args: MelExprNode[];
|
|
1889
|
-
} | {
|
|
1890
|
-
kind: "obj";
|
|
1891
|
-
fields: MelObjField[];
|
|
1892
|
-
} | {
|
|
1893
|
-
kind: "arr";
|
|
1894
|
-
elements: MelExprNode[];
|
|
1895
|
-
};
|
|
1896
|
-
/**
|
|
1897
|
-
* Lower MEL expression to Core expression.
|
|
1898
|
-
*
|
|
1899
|
-
* @param input - MEL canonical IR expression
|
|
1900
|
-
* @param ctx - Lowering context
|
|
1901
|
-
* @returns Core runtime IR expression
|
|
1902
|
-
* @throws LoweringError if expression cannot be lowered
|
|
1903
|
-
*
|
|
1904
|
-
* @see SPEC v0.4.0 §17.3
|
|
1905
|
-
*/
|
|
1906
|
-
declare function lowerExprNode(input: MelExprNode, ctx: ExprLoweringContext): ExprNode$2;
|
|
1907
|
-
|
|
1908
2013
|
/**
|
|
1909
2014
|
* Patch Lowering
|
|
1910
2015
|
*
|
|
@@ -2713,4 +2818,4 @@ declare function parseSource(source: string): ParseResult;
|
|
|
2713
2818
|
*/
|
|
2714
2819
|
declare function check(source: string): Diagnostic[];
|
|
2715
2820
|
|
|
2716
|
-
export { type ASTNode, type ActionNode, type ActionSpec, type AddActionAvailableOp, type AddComputedOp, type AddConstraintOp, type AddFieldOp, type AddTypeOp, type AllowedSysPrefix, type ArrayLiteralExprNode, type ArrayTypeNode, type BinaryExprNode, type BinaryOperator, type CompileMelDomainOptions, type CompileMelDomainResult, type CompileMelPatchOptions, type CompileMelPatchResult, type CompileOptions, type CompileResult, type CompileTrace, type ComputedFieldSpec, type ComputedNode, type ComputedSpec, type ConditionalPatchOp, type CoreExprNode, type CoreFlowNode, DEFAULT_ACTION_CONTEXT, DEFAULT_PATCH_CONTEXT, DEFAULT_SCHEMA_CONTEXT, DIAGNOSTIC_CODES, type Diagnostic, type DiagnosticCode, type DiagnosticSeverity, type DomainMember, type DomainSchema as DomainModule, type DomainNode, type DomainSchema, EFFECT_ARGS_CONTEXT, type EffectArgNode, type EffectStmtNode, type EvaluatedPatch, type EvaluatedPatchOp, type EvaluationContext, type EvaluationMeta, type EvaluationSnapshot, type ExprLoweringContext, type ExprNode$1 as ExprNode, type FailStmtNode, type FieldSpec, type FieldType, type FragmentRenderOptions, type FunctionCallExprNode, type GenerateResult, type GuardedStmtNode, type IRPatchPath, type IRPathSegment, type IdentifierExprNode, type ImportNode, type IndexAccessExprNode, type IndexSegmentNode, type InnerStmtNode, type IterationVarExprNode, KEYWORDS, type LexResult, Lexer, type LiteralExprNode, type LiteralTypeNode, type LoweredPatchOp, type LoweredTypeExpr, type LoweredTypeField, LoweringError, type LoweringErrorCode, type MelExprNode, type MelIRPatchPath, type MelIRPathSegment, type MelObjField, type MelPatchFragment, type MelPatchOp, type MelPathNode, type MelPathSegment, type MelPrimitive, type MelRuntimePatch, type MelRuntimePatchOp, type MelSystemPath, type MelTypeExpr, type MelTypeField, type ObjectLiteralExprNode, type ObjectPropertyNode, type ObjectTypeNode, type OnceIntentStmtNode, type OnceStmtNode, type ParamNode, type ParseResult, Parser, type PatchEvaluationResult, type PatchFragment, type PatchLoweringContext, type PatchOp, type PatchStmtNode, type PathNode, type PathSegmentNode, type Position, Precedence, type ProgramNode, type PropertyAccessExprNode, type PropertySegmentNode, RESERVED_KEYWORDS, type RecordTypeNode, type RelatedDiagnostic, type RenderOptions, type ExprNode as RendererExprNode, type RuntimeConditionalPatchOp, type RuntimePatchEvaluationResult, type RuntimePatchSkipReason, type SchemaConditionalPatchOp, Scope, type ScopeAnalysisResult, ScopeAnalyzer, SemanticValidator, type SetDefaultValueOp, type SetFieldTypeOp, type SimpleTypeNode, type SkippedRuntimePatch, type SourceLocation, type StateFieldNode, type StateNode, type StateSpec, type StopStmtNode, type Symbol, type SymbolKind, type SystemIdentExprNode, type TernaryExprNode, type Token, type TokenKind, type TypeDeclNode, type TypeDefinition, type TypeExpr, type TypeExprNode, type TypeField, type TypeFieldNode, type TypeSpec, type UnaryExprNode, type UnionTypeNode, type ValidationResult, type WhenStmtNode, analyzeScope, applyPatchToWorkingSnapshot, check, classifyCondition, compile, compileMelDomain, compileMelPatch, createError, createEvaluationContext, createInfo, createLocation, createPointLocation, createPosition, createToken, createWarning, evaluateCondition, evaluateConditionalPatchOps, evaluateExpr, evaluatePatchExpressions, evaluatePatches, evaluateRuntimePatches, evaluateRuntimePatchesWithTrace, extractTypeName, filterBySeverity, formatDiagnostic, formatDiagnosticCode, formatDiagnostics, generate, getBinaryPrecedence, getDiagnosticInfo, getKeywordKind, hasErrors, invalidKindForContext, invalidShape, invalidSysPath, isBinaryOp, isError, isExprNode, isKeyword, isReserved, isRightAssociative, isStmtNode, isUnaryOp, lowerExprNode, lowerPatchFragments, lowerRuntimePatch, lowerRuntimePatches, lowerSystemValues, mergeLocations, normalizeExpr, normalizeFunctionCall, parse, parseSource, renderAsDomain, renderExprNode, renderFragment, renderFragments, renderFragmentsByKind, renderPatchOp, renderTypeExpr, renderTypeField, renderValue, tokenToBinaryOp, tokenize, unknownCallFn, unknownNodeKind, unsupportedBase, validateSemantics };
|
|
2821
|
+
export { type ASTNode, type ActionNode, type ActionSpec, type AddActionAvailableOp, type AddComputedOp, type AddConstraintOp, type AddFieldOp, type AddTypeOp, type AllowedSysPrefix, type ArrayLiteralExprNode, type ArrayTypeNode, type BinaryExprNode, type BinaryOperator, type CanonicalDomainSchema, type CompileMelDomainOptions, type CompileMelDomainResult, type CompileMelPatchOptions, type CompileMelPatchResult, type CompileOptions, type CompileResult, type CompileTrace, type CompilerActionSpec, type CompilerComputedFieldSpec, type CompilerExprNode, type CompilerFlowNode, type ComputedFieldSpec, type ComputedNode, type ComputedSpec, type ConditionalPatchOp, type CoreExprNode, type CoreFlowNode, DEFAULT_ACTION_CONTEXT, DEFAULT_PATCH_CONTEXT, DEFAULT_SCHEMA_CONTEXT, DIAGNOSTIC_CODES, type Diagnostic, type DiagnosticCode, type DiagnosticSeverity, type DomainMember, type DomainSchema as DomainModule, type DomainNode, type DomainSchema, EFFECT_ARGS_CONTEXT, type EffectArgNode, type EffectStmtNode, type EvaluatedPatch, type EvaluatedPatchOp, type EvaluationContext, type EvaluationMeta, type EvaluationSnapshot, type ExprLoweringContext, type ExprNode$1 as ExprNode, type FailStmtNode, type FieldSpec, type FieldType, type FlowDeclNode, type FlowStmtNode, type FragmentRenderOptions, type FunctionCallExprNode, type GenerateCanonicalResult, type GenerateResult, type GuardedStmtNode, type IRPatchPath, type IRPathSegment, type IdentifierExprNode, type ImportNode, type IncludeStmtNode, type IndexAccessExprNode, type IndexSegmentNode, type InnerStmtNode, type IterationVarExprNode, KEYWORDS, type LexResult, Lexer, type LiteralExprNode, type LiteralTypeNode, type LoweredPatchOp, type LoweredTypeExpr, type LoweredTypeField, LoweringError, type LoweringErrorCode, type MelExprNode, type MelIRPatchPath, type MelIRPathSegment, type MelObjField, type MelPatchFragment, type MelPatchOp, type MelPathNode, type MelPathSegment, type MelPrimitive, type MelRuntimePatch, type MelRuntimePatchOp, type MelSystemPath, type MelTypeExpr, type MelTypeField, type ObjectLiteralExprNode, type ObjectPropertyNode, type ObjectTypeNode, type OnceIntentStmtNode, type OnceStmtNode, type ParamNode, type ParseResult, Parser, type PatchEvaluationResult, type PatchFragment, type PatchLoweringContext, type PatchOp, type PatchStmtNode, type PathNode, type PathSegmentNode, type Position, Precedence, type ProgramNode, type PropertyAccessExprNode, type PropertySegmentNode, RESERVED_KEYWORDS, type RecordTypeNode, type RelatedDiagnostic, type RenderOptions, type ExprNode as RendererExprNode, type RuntimeConditionalPatchOp, type RuntimePatchEvaluationResult, type RuntimePatchSkipReason, type SchemaConditionalPatchOp, Scope, type ScopeAnalysisResult, ScopeAnalyzer, SemanticValidator, type SetDefaultValueOp, type SetFieldTypeOp, type SimpleTypeNode, type SkippedRuntimePatch, type SourceLocation, type StateFieldNode, type StateNode, type StateSpec, type StopStmtNode, type Symbol, type SymbolKind, type SystemIdentExprNode, type TernaryExprNode, type Token, type TokenKind, type TypeDeclNode, type TypeDefinition, type TypeExpr, type TypeExprNode, type TypeField, type TypeFieldNode, type TypeSpec, type UnaryExprNode, type UnionTypeNode, type ValidationResult, type WhenStmtNode, analyzeScope, applyPatchToWorkingSnapshot, check, classifyCondition, compile, compileMelDomain, compileMelPatch, createError, createEvaluationContext, createInfo, createLocation, createPointLocation, createPosition, createToken, createWarning, evaluateCondition, evaluateConditionalPatchOps, evaluateExpr, evaluatePatchExpressions, evaluatePatches, evaluateRuntimePatches, evaluateRuntimePatchesWithTrace, extractTypeName, filterBySeverity, formatDiagnostic, formatDiagnosticCode, formatDiagnostics, generate, generateCanonical, getBinaryPrecedence, getDiagnosticInfo, getKeywordKind, hasErrors, invalidKindForContext, invalidShape, invalidSysPath, isBinaryOp, isError, isExprNode, isKeyword, isReserved, isRightAssociative, isStmtNode, isUnaryOp, lowerExprNode, lowerPatchFragments, lowerRuntimePatch, lowerRuntimePatches, lowerSystemValues, mergeLocations, normalizeExpr, normalizeFunctionCall, parse, parseSource, renderAsDomain, renderExprNode, renderFragment, renderFragments, renderFragmentsByKind, renderPatchOp, renderTypeExpr, renderTypeField, renderValue, tokenToBinaryOp, tokenize, unknownCallFn, unknownNodeKind, unsupportedBase, validateSemantics };
|