@dancrumb/cant-compiler 0.0.0-stage → 0.10.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/dist/bodies.d.ts +33 -0
- package/dist/bodies.d.ts.map +1 -0
- package/dist/bodies.js +512 -0
- package/dist/bodies.js.map +1 -0
- package/dist/check.d.ts +18 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/check.js +30 -0
- package/dist/check.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +90 -0
- package/dist/cli.js.map +1 -0
- package/dist/compile.d.ts +20 -0
- package/dist/compile.d.ts.map +1 -0
- package/dist/compile.js +777 -0
- package/dist/compile.js.map +1 -0
- package/dist/constants.d.ts +22 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +262 -0
- package/dist/constants.js.map +1 -0
- package/dist/declarations.d.ts +54 -0
- package/dist/declarations.d.ts.map +1 -0
- package/dist/declarations.js +202 -0
- package/dist/declarations.js.map +1 -0
- package/dist/diagnostic.d.ts +19 -0
- package/dist/diagnostic.d.ts.map +1 -0
- package/dist/diagnostic.js +27 -0
- package/dist/diagnostic.js.map +1 -0
- package/dist/entities.d.ts +32 -0
- package/dist/entities.d.ts.map +1 -0
- package/dist/entities.js +235 -0
- package/dist/entities.js.map +1 -0
- package/dist/evaluate.d.ts +30 -0
- package/dist/evaluate.d.ts.map +1 -0
- package/dist/evaluate.js +79 -0
- package/dist/evaluate.js.map +1 -0
- package/dist/host.d.ts +8 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +13 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +23 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +93 -0
- package/dist/manifest.js.map +1 -0
- package/dist/modules.d.ts +84 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +259 -0
- package/dist/modules.js.map +1 -0
- package/dist/program.d.ts +24 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +38 -0
- package/dist/program.js.map +1 -0
- package/dist/resolve.d.ts +24 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +203 -0
- package/dist/resolve.js.map +1 -0
- package/dist/stdlib.d.ts +12 -0
- package/dist/stdlib.d.ts.map +1 -0
- package/dist/stdlib.js +38 -0
- package/dist/stdlib.js.map +1 -0
- package/dist/typecheck.d.ts +52 -0
- package/dist/typecheck.d.ts.map +1 -0
- package/dist/typecheck.js +1408 -0
- package/dist/typecheck.js.map +1 -0
- package/dist/types.d.ts +130 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +199 -0
- package/dist/types.js.map +1 -0
- package/dist/weave.d.ts +3 -0
- package/dist/weave.d.ts.map +1 -0
- package/dist/weave.js +40 -0
- package/dist/weave.js.map +1 -0
- package/package.json +47 -3
- package/README.md +0 -3
package/dist/modules.js
ADDED
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { join, resolve as resolvePath } from 'node:path';
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
3
|
+
import { check } from './check.js';
|
|
4
|
+
import { MAIN_NAMESPACE } from './declarations.js';
|
|
5
|
+
import { error } from './diagnostic.js';
|
|
6
|
+
import { findManifest, MANIFEST } from './manifest.js';
|
|
7
|
+
import { STANDARD_LIBRARY } from './stdlib.js';
|
|
8
|
+
const TYPE_KIND = {
|
|
9
|
+
enumDeclaration: 'enum',
|
|
10
|
+
model: 'model',
|
|
11
|
+
entity: 'entity',
|
|
12
|
+
errorDeclaration: 'error',
|
|
13
|
+
};
|
|
14
|
+
/** A URL with a scheme, such as `https:` or `file:`, as opposed to a relative path. */
|
|
15
|
+
const HAS_SCHEME = /^[A-Za-z][A-Za-z0-9+.-]*:/;
|
|
16
|
+
const textOf = (literal) => literal.parts.map((part) => (part.type === 'text' ? part.value : '')).join('');
|
|
17
|
+
const nameOf = (name) => (name.type === 'qualifiedIdentifier' ? name.name : name);
|
|
18
|
+
export const symbolOf = (module, declaration) => declaration.type === 'action'
|
|
19
|
+
? { kind: 'action', name: declaration.name.value, module, declaration }
|
|
20
|
+
: declaration.type === 'const'
|
|
21
|
+
? { kind: 'const', name: declaration.name.value, module, declaration }
|
|
22
|
+
: { kind: 'type', typeKind: TYPE_KIND[declaration.type], name: declaration.name.value, module, declaration };
|
|
23
|
+
/** Whether two symbols are the same declaration, reached by different imports. */
|
|
24
|
+
const sameSymbol = (a, b) => a.module === b.module && a.name === b.name && a.kind === b.kind;
|
|
25
|
+
/** Whether two symbols can't share a name in one namespace: constants clash with everything (docs/adr/0034-top-level-constants.md). */
|
|
26
|
+
const clashes = (a, b) => a === b || a === 'const' || b === 'const';
|
|
27
|
+
/**
|
|
28
|
+
* Load a program: the entry module, and every module it imports, directly or not. Each module is
|
|
29
|
+
* parsed and its declarations collected (see `check`), its imports are resolved
|
|
30
|
+
* (docs/adr/0031-module-resolution.md), and its exports, including re-exports, are worked out
|
|
31
|
+
* (docs/adr/0006-imports.md). Each import's symbols are placed in the namespace its `into`
|
|
32
|
+
* names, or the namespace it appears in, and names that clash there are reported.
|
|
33
|
+
*/
|
|
34
|
+
export function loadProgram(entry, host) {
|
|
35
|
+
const entryPath = resolvePath(entry);
|
|
36
|
+
const diagnostics = [];
|
|
37
|
+
const { manifest, diagnostics: manifestDiagnostics } = findManifest(entryPath, host);
|
|
38
|
+
diagnostics.push(...manifestDiagnostics);
|
|
39
|
+
const modules = new Map();
|
|
40
|
+
const report = (module, diagnostic) => {
|
|
41
|
+
diagnostics.push({ ...diagnostic, file: module.path });
|
|
42
|
+
};
|
|
43
|
+
// Load every module the entry module reaches, breadth first.
|
|
44
|
+
const queue = [{ path: entryPath }];
|
|
45
|
+
while (queue.length > 0) {
|
|
46
|
+
const next = queue.shift();
|
|
47
|
+
if (next === undefined || modules.has(next.path))
|
|
48
|
+
continue;
|
|
49
|
+
const source = host.readFile(next.path);
|
|
50
|
+
if (source === undefined) {
|
|
51
|
+
if (next.from === undefined) {
|
|
52
|
+
diagnostics.push({
|
|
53
|
+
...error('module-not-found', `Can't read ${next.path}.`, { start: { line: 1, column: 1 }, end: { line: 1, column: 1 } }),
|
|
54
|
+
file: next.path,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
next.from.module.imports.set(next.from.declaration, { kind: 'unresolved' });
|
|
59
|
+
report(next.from.module, error('module-not-found', `There is no module at ${next.path}.`, next.from.declaration.module.position));
|
|
60
|
+
}
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const result = check(source);
|
|
64
|
+
const module = {
|
|
65
|
+
path: next.path,
|
|
66
|
+
source,
|
|
67
|
+
...(result.program && { program: result.program }),
|
|
68
|
+
...(result.symbols && { symbols: result.symbols }),
|
|
69
|
+
imports: new Map(),
|
|
70
|
+
imported: new Map(),
|
|
71
|
+
exports: new Map(),
|
|
72
|
+
};
|
|
73
|
+
modules.set(next.path, module);
|
|
74
|
+
for (const diagnostic of result.diagnostics)
|
|
75
|
+
report(module, diagnostic);
|
|
76
|
+
for (const { declaration } of module.symbols?.imports ?? []) {
|
|
77
|
+
const target = resolveImport(module, declaration, manifest, (diagnostic) => {
|
|
78
|
+
report(module, diagnostic);
|
|
79
|
+
});
|
|
80
|
+
module.imports.set(declaration, target);
|
|
81
|
+
if (target.kind === 'file')
|
|
82
|
+
queue.push({ path: target.path, from: { module, declaration } });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
// Work out each module's exports. A module's re-exports depend on the exports of the modules
|
|
86
|
+
// it imports, so this follows imports, and stops at a module it is already working out, to
|
|
87
|
+
// survive cycles. There, only that module's own exported declarations are seen.
|
|
88
|
+
const state = new Map();
|
|
89
|
+
const exportsOf = (module) => {
|
|
90
|
+
if (state.has(module))
|
|
91
|
+
return module.exports;
|
|
92
|
+
state.set(module, 'working');
|
|
93
|
+
for (const [name, declaration] of module.symbols?.exports ?? []) {
|
|
94
|
+
if (declaration.type !== 'reExport')
|
|
95
|
+
module.exports.set(name, symbolOf(module.path, declaration));
|
|
96
|
+
}
|
|
97
|
+
placeImports(module);
|
|
98
|
+
for (const { namespace, declaration } of module.symbols?.reExports ?? []) {
|
|
99
|
+
const symbol = findSymbol(module, namespace, declaration.name);
|
|
100
|
+
if (symbol === undefined) {
|
|
101
|
+
report(module, error('unknown-name', `${describeName(declaration.name)} isn't a symbol this module imports, so it can't re-export it.`, declaration.name.position));
|
|
102
|
+
}
|
|
103
|
+
else if (symbol.module === module.path) {
|
|
104
|
+
report(module, error('re-export-own', `${describeName(declaration.name)} is declared in this module. A module exports its own declarations by putting \`export\` before them.`, declaration.name.position));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
module.exports.set((declaration.alias ?? nameOf(declaration.name)).value, symbol);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
state.set(module, 'done');
|
|
111
|
+
return module.exports;
|
|
112
|
+
};
|
|
113
|
+
const exportsOfTarget = (target) => {
|
|
114
|
+
if (target.kind === 'standard') {
|
|
115
|
+
const standard = STANDARD_LIBRARY.get(target.name);
|
|
116
|
+
return new Map([...(standard ?? [])].map(([name, kind]) => [
|
|
117
|
+
name,
|
|
118
|
+
kind === 'action'
|
|
119
|
+
? { kind: 'action', name, module: `cant::${target.name}` }
|
|
120
|
+
: { kind: 'type', typeKind: 'error', name, module: `cant::${target.name}` },
|
|
121
|
+
]));
|
|
122
|
+
}
|
|
123
|
+
if (target.kind === 'file') {
|
|
124
|
+
const imported = modules.get(target.path);
|
|
125
|
+
if (imported !== undefined)
|
|
126
|
+
return exportsOf(imported);
|
|
127
|
+
}
|
|
128
|
+
return new Map();
|
|
129
|
+
};
|
|
130
|
+
// Put each import's symbols in its namespace, and report names that clash there.
|
|
131
|
+
const placed = new Set();
|
|
132
|
+
const placeImports = (module) => {
|
|
133
|
+
if (placed.has(module))
|
|
134
|
+
return;
|
|
135
|
+
placed.add(module);
|
|
136
|
+
for (const { namespace, declaration } of module.symbols?.imports ?? []) {
|
|
137
|
+
const target = module.imports.get(declaration) ?? { kind: 'unresolved' };
|
|
138
|
+
for (const into of namespacesFor(declaration, namespace)) {
|
|
139
|
+
let names = module.imported.get(into);
|
|
140
|
+
if (names === undefined) {
|
|
141
|
+
names = new Map();
|
|
142
|
+
module.imported.set(into, names);
|
|
143
|
+
}
|
|
144
|
+
for (const [name, symbol] of exportsOfTarget(target)) {
|
|
145
|
+
const local = localSymbol(module, into, name, symbol.kind);
|
|
146
|
+
if (local !== undefined) {
|
|
147
|
+
report(module, error('import-collision', `This import brings ${name} into namespace ${into}, which already declares ${name} on line ${String(local.declaration?.position.start.line)}. Import it into a namespace of its own with \`into\`.`, declaration.module.position));
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
const earlier = names.get(name);
|
|
151
|
+
if (earlier !== undefined && clashes(earlier.symbol.kind, symbol.kind) && !sameSymbol(earlier.symbol, symbol)) {
|
|
152
|
+
report(module, error('import-collision', `This import brings ${name} into namespace ${into}, but the import on line ${String(earlier.via.position.start.line)} already brought in a different ${name}. Import one of them into a namespace of its own with \`into\`.`, declaration.module.position));
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (earlier === undefined)
|
|
156
|
+
names.set(name, { symbol, via: declaration });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
for (const module of modules.values())
|
|
162
|
+
exportsOf(module);
|
|
163
|
+
return { entry: entryPath, ...(manifest && { manifest }), modules, diagnostics };
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* The namespaces an import places its symbols in: the one its `into` names, or else the current
|
|
167
|
+
* namespace and, for a symbolic module identifier, a namespace named after the module
|
|
168
|
+
* (docs/adr/0006-imports.md, docs/adr/0038-namespaces-from-imports.md).
|
|
169
|
+
*/
|
|
170
|
+
function namespacesFor(declaration, current) {
|
|
171
|
+
if (declaration.namespace !== undefined)
|
|
172
|
+
return [declaration.namespace.value];
|
|
173
|
+
if (declaration.module.type !== 'moduleName')
|
|
174
|
+
return [current];
|
|
175
|
+
const named = declaration.module.name.value;
|
|
176
|
+
return named === current ? [current] : [current, named];
|
|
177
|
+
}
|
|
178
|
+
/** Where an import leads (docs/adr/0031-module-resolution.md). */
|
|
179
|
+
function resolveImport(module, declaration, manifest, report) {
|
|
180
|
+
if (declaration.moduleType !== undefined) {
|
|
181
|
+
report(error('module-type', '`as` accepts no module types yet, so every module is Cant source. Leave `as` out.', declaration.moduleType.position));
|
|
182
|
+
return { kind: 'unresolved' };
|
|
183
|
+
}
|
|
184
|
+
const identifier = declaration.module;
|
|
185
|
+
if (identifier.type === 'string') {
|
|
186
|
+
const path = fileFromUrl(module.path, textOf(identifier));
|
|
187
|
+
if (path === undefined) {
|
|
188
|
+
report(error('remote-module', `"${textOf(identifier)}" isn't a local file. For now, every module must be read from a file, and remote URLs can't be imported.`, identifier.position));
|
|
189
|
+
return { kind: 'unresolved' };
|
|
190
|
+
}
|
|
191
|
+
return { kind: 'file', path };
|
|
192
|
+
}
|
|
193
|
+
const scope = identifier.scope?.value ?? 'cant';
|
|
194
|
+
const name = identifier.name.value;
|
|
195
|
+
if (scope === 'cant') {
|
|
196
|
+
if (STANDARD_LIBRARY.has(name))
|
|
197
|
+
return { kind: 'standard', name };
|
|
198
|
+
report(error('module-not-found', `The standard library has no module called cant::${name}.`, identifier.position));
|
|
199
|
+
return { kind: 'unresolved' };
|
|
200
|
+
}
|
|
201
|
+
const directory = manifest?.scopes.get(scope);
|
|
202
|
+
if (directory === undefined) {
|
|
203
|
+
report(error('unknown-scope', manifest === undefined
|
|
204
|
+
? `There is no ${MANIFEST} to say where the ${scope} scope is. Add one that maps "${scope}" to a directory.`
|
|
205
|
+
: `${manifest.path} doesn't map the ${scope} scope to a directory.`, identifier.scope?.position ?? identifier.position));
|
|
206
|
+
return { kind: 'unresolved' };
|
|
207
|
+
}
|
|
208
|
+
return { kind: 'file', path: join(directory, `${name}.cant`) };
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* The file a URL in a module names, resolved against the module's own location, or `undefined`
|
|
212
|
+
* if it is a remote URL (docs/adr/0031-module-resolution.md).
|
|
213
|
+
*/
|
|
214
|
+
export function fileFromUrl(modulePath, url) {
|
|
215
|
+
if (HAS_SCHEME.test(url) && !url.startsWith('file:'))
|
|
216
|
+
return undefined;
|
|
217
|
+
return fileURLToPath(new URL(url, pathToFileURL(modulePath)));
|
|
218
|
+
}
|
|
219
|
+
/** The module's own declaration of `name` in `namespace` that a symbol of `kind` would clash with. */
|
|
220
|
+
function localSymbol(module, namespace, name, kind) {
|
|
221
|
+
const declared = module.symbols?.namespaces.get(namespace);
|
|
222
|
+
if (declared === undefined)
|
|
223
|
+
return undefined;
|
|
224
|
+
const candidates = [
|
|
225
|
+
declared.types.get(name),
|
|
226
|
+
declared.actions.get(name),
|
|
227
|
+
declared.constants.get(name),
|
|
228
|
+
].filter((declaration) => declaration !== undefined);
|
|
229
|
+
return candidates.map((declaration) => symbolOf(module.path, declaration)).find((symbol) => clashes(symbol.kind, kind));
|
|
230
|
+
}
|
|
231
|
+
/** Every symbol `name` could mean in `namespace` of `module`: its own declarations, then imported ones. */
|
|
232
|
+
export function symbolsNamed(module, namespace, name) {
|
|
233
|
+
const found = [];
|
|
234
|
+
const declared = module.symbols?.namespaces.get(namespace);
|
|
235
|
+
for (const declaration of [declared?.types.get(name), declared?.actions.get(name), declared?.constants.get(name)]) {
|
|
236
|
+
if (declaration !== undefined)
|
|
237
|
+
found.push(symbolOf(module.path, declaration));
|
|
238
|
+
}
|
|
239
|
+
const imported = module.imported.get(namespace)?.get(name)?.symbol;
|
|
240
|
+
if (imported !== undefined && !found.some((symbol) => clashes(symbol.kind, imported.kind)))
|
|
241
|
+
found.push(imported);
|
|
242
|
+
return found;
|
|
243
|
+
}
|
|
244
|
+
/** Whether `namespace` exists in `module`: it declares something there, or imports into it. */
|
|
245
|
+
export function hasNamespace(module, namespace) {
|
|
246
|
+
return namespace === MAIN_NAMESPACE || module.symbols?.namespaces.has(namespace) === true || module.imported.has(namespace);
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* The symbol a name means where it appears: in the namespace it names, or the current namespace
|
|
250
|
+
* if it names none (docs/adr/0005-module-namespaces.md). When it could mean symbols of several
|
|
251
|
+
* kinds, the first is a type, then an action, then a constant.
|
|
252
|
+
*/
|
|
253
|
+
export function findSymbol(module, namespace, name) {
|
|
254
|
+
return name.type === 'qualifiedIdentifier'
|
|
255
|
+
? symbolsNamed(module, name.namespace.value, name.name.value)[0]
|
|
256
|
+
: symbolsNamed(module, namespace, name.value)[0];
|
|
257
|
+
}
|
|
258
|
+
export const describeName = (name) => name.type === 'qualifiedIdentifier' ? `${name.namespace.value}::${name.name.value}` : name.value;
|
|
259
|
+
//# sourceMappingURL=modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../src/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAUxD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,cAAc,EAA4C,MAAM,mBAAmB,CAAC;AAC7F,OAAO,EAAE,KAAK,EAAmB,MAAM,iBAAiB,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAiB,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAyD/C,MAAM,SAAS,GAA8C;IAC3D,eAAe,EAAE,MAAM;IACvB,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,gBAAgB,EAAE,OAAO;CA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GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc,EAAE,SAAiB,EAAE,IAAU;IACtE,OAAO,IAAI,CAAC,IAAI,KAAK,qBAAqB;QACxC,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAChE,CAAC,CAAC,YAAY,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAU,EAAU,EAAE,CACjD,IAAI,CAAC,IAAI,KAAK,qBAAqB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Locals } from './bodies.ts';
|
|
2
|
+
import { type NavigationField } from './entities.ts';
|
|
3
|
+
import { type Host } from './host.ts';
|
|
4
|
+
import { type LoadedProgram } from './modules.ts';
|
|
5
|
+
import { type References } from './resolve.ts';
|
|
6
|
+
import { type TypeRecord } from './typecheck.ts';
|
|
7
|
+
export interface CheckedProgram extends LoadedProgram {
|
|
8
|
+
/** The top-level names the program refers to, resolved to the symbols they mean. */
|
|
9
|
+
references: References;
|
|
10
|
+
/** The local binding each local name in an expression refers to. */
|
|
11
|
+
locals: Locals;
|
|
12
|
+
/** Each entity's navigation fields, by the entity's module and name, then the field's name. */
|
|
13
|
+
navigation: Map<string, Map<string, NavigationField>>;
|
|
14
|
+
/** What the type checker found about each expression. */
|
|
15
|
+
types: TypeRecord;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Check a whole program, starting from its entry module: load it and every module it imports,
|
|
19
|
+
* report syntax errors and names declared twice in each, resolve imports and exports, resolve
|
|
20
|
+
* the names its declarations and bodies refer to, check what its entities, relations and
|
|
21
|
+
* security declarations name, and check its types. Every diagnostic names its file.
|
|
22
|
+
*/
|
|
23
|
+
export declare function checkProgram(entry: string, host?: Host): CheckedProgram;
|
|
24
|
+
//# sourceMappingURL=program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAGzD,OAAO,EAAiB,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAkB,KAAK,IAAI,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAe,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE7D,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,oFAAoF;IACpF,UAAU,EAAE,UAAU,CAAC;IACvB,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,+FAA+F;IAC/F,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;IACtD,yDAAyD;IACzD,KAAK,EAAE,UAAU,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,IAAqB,GAAG,cAAc,CAuBvF"}
|
package/dist/program.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { resolveBodies } from './bodies.js';
|
|
2
|
+
import { checkConstants } from './constants.js';
|
|
3
|
+
import { checkEntities } from './entities.js';
|
|
4
|
+
import { fileSystemHost } from './host.js';
|
|
5
|
+
import { loadProgram } from './modules.js';
|
|
6
|
+
import { resolveNames } from './resolve.js';
|
|
7
|
+
import { checkTypes } from './typecheck.js';
|
|
8
|
+
/**
|
|
9
|
+
* Check a whole program, starting from its entry module: load it and every module it imports,
|
|
10
|
+
* report syntax errors and names declared twice in each, resolve imports and exports, resolve
|
|
11
|
+
* the names its declarations and bodies refer to, check what its entities, relations and
|
|
12
|
+
* security declarations name, and check its types. Every diagnostic names its file.
|
|
13
|
+
*/
|
|
14
|
+
export function checkProgram(entry, host = fileSystemHost) {
|
|
15
|
+
const program = loadProgram(entry, host);
|
|
16
|
+
const names = resolveNames(program);
|
|
17
|
+
const bodies = resolveBodies(program, names.references);
|
|
18
|
+
const entities = checkEntities(program, names.references);
|
|
19
|
+
const types = checkTypes({ ...program, references: names.references, locals: bodies.locals, navigation: entities.navigation });
|
|
20
|
+
const constants = checkConstants({ ...program, references: names.references, locals: bodies.locals });
|
|
21
|
+
const diagnostics = [
|
|
22
|
+
...program.diagnostics,
|
|
23
|
+
...names.diagnostics,
|
|
24
|
+
...bodies.diagnostics,
|
|
25
|
+
...entities.diagnostics,
|
|
26
|
+
...types.diagnostics,
|
|
27
|
+
...constants,
|
|
28
|
+
];
|
|
29
|
+
return {
|
|
30
|
+
...program,
|
|
31
|
+
references: names.references,
|
|
32
|
+
locals: bodies.locals,
|
|
33
|
+
navigation: entities.navigation,
|
|
34
|
+
types: types.record,
|
|
35
|
+
diagnostics,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=program.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAe,MAAM,aAAa,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAwB,MAAM,eAAe,CAAC;AACpE,OAAO,EAAE,cAAc,EAAa,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,WAAW,E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|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Name } from '@dancrumb/cant-shared';
|
|
2
|
+
import { type Diagnostic } from './diagnostic.ts';
|
|
3
|
+
import { type LoadedProgram, type ModuleSymbol } from './modules.ts';
|
|
4
|
+
/** The names that declarations refer to, resolved to the symbols they mean. */
|
|
5
|
+
export type References = Map<Name, ModuleSymbol>;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the top-level names that a program's declarations refer to, in every module, and
|
|
8
|
+
* report any that can't be found, or that name the wrong kind of thing:
|
|
9
|
+
*
|
|
10
|
+
* - the types of parameters, return values, fields and constants, and the types in `instanceOf`;
|
|
11
|
+
* - the errors in `raises` and `passes` clauses, and in `raise` statements;
|
|
12
|
+
* - the named `data` model of an error, and the models in an entity's `models` block;
|
|
13
|
+
* - the entities at each end of a relation, and in `@subject is <type>`;
|
|
14
|
+
* - the action each trigger runs.
|
|
15
|
+
*
|
|
16
|
+
* Names in expressions that may be local, such as identifiers and calls in an action's body,
|
|
17
|
+
* are resolved by `resolveBodies`, which knows the local scopes. Permissions' group kinds and
|
|
18
|
+
* roles, and the fields entities name, are checked by `checkEntities`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveNames(program: LoadedProgram): {
|
|
21
|
+
references: References;
|
|
22
|
+
diagnostics: Diagnostic[];
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAA0B,MAAM,uBAAuB,CAAC;AAG1E,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,YAAY,EAElB,MAAM,cAAc,CAAC;AA4CtB,+EAA+E;AAC/E,MAAM,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAEjD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,UAAU,EAAE,CAAA;CAAE,CAS1G"}
|
package/dist/resolve.js
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { MAIN_NAMESPACE } from './declarations.js';
|
|
2
|
+
import { error } from './diagnostic.js';
|
|
3
|
+
import { describeName, fileFromUrl, hasNamespace, symbolsNamed, } from './modules.js';
|
|
4
|
+
const ALLOWED = {
|
|
5
|
+
'value type': ['enum', 'model', 'entity'],
|
|
6
|
+
type: ['enum', 'model', 'entity', 'error'],
|
|
7
|
+
error: ['error'],
|
|
8
|
+
model: ['model'],
|
|
9
|
+
entity: ['entity'],
|
|
10
|
+
};
|
|
11
|
+
const ARTICLE = {
|
|
12
|
+
'value type': 'a type',
|
|
13
|
+
type: 'a type',
|
|
14
|
+
error: 'an error',
|
|
15
|
+
model: 'a model',
|
|
16
|
+
entity: 'an entity',
|
|
17
|
+
action: 'an action',
|
|
18
|
+
};
|
|
19
|
+
const describeSymbol = (symbol) => symbol.kind === 'action'
|
|
20
|
+
? 'an action'
|
|
21
|
+
: symbol.kind === 'const'
|
|
22
|
+
? 'a constant'
|
|
23
|
+
: symbol.typeKind === 'enum' || symbol.typeKind === 'error' || symbol.typeKind === 'entity'
|
|
24
|
+
? `an ${symbol.typeKind}`
|
|
25
|
+
: 'a model';
|
|
26
|
+
const fits = (symbol, expected) => expected === 'action'
|
|
27
|
+
? symbol.kind === 'action'
|
|
28
|
+
: symbol.kind === 'type' && symbol.typeKind !== undefined && ALLOWED[expected].includes(symbol.typeKind);
|
|
29
|
+
/**
|
|
30
|
+
* Resolve the top-level names that a program's declarations refer to, in every module, and
|
|
31
|
+
* report any that can't be found, or that name the wrong kind of thing:
|
|
32
|
+
*
|
|
33
|
+
* - the types of parameters, return values, fields and constants, and the types in `instanceOf`;
|
|
34
|
+
* - the errors in `raises` and `passes` clauses, and in `raise` statements;
|
|
35
|
+
* - the named `data` model of an error, and the models in an entity's `models` block;
|
|
36
|
+
* - the entities at each end of a relation, and in `@subject is <type>`;
|
|
37
|
+
* - the action each trigger runs.
|
|
38
|
+
*
|
|
39
|
+
* Names in expressions that may be local, such as identifiers and calls in an action's body,
|
|
40
|
+
* are resolved by `resolveBodies`, which knows the local scopes. Permissions' group kinds and
|
|
41
|
+
* roles, and the fields entities name, are checked by `checkEntities`.
|
|
42
|
+
*/
|
|
43
|
+
export function resolveNames(program) {
|
|
44
|
+
const references = new Map();
|
|
45
|
+
const diagnostics = [];
|
|
46
|
+
for (const module of program.modules.values()) {
|
|
47
|
+
resolveModule(module, references, (diagnostic) => {
|
|
48
|
+
diagnostics.push({ ...diagnostic, file: module.path });
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return { references, diagnostics };
|
|
52
|
+
}
|
|
53
|
+
function resolveModule(module, references, report) {
|
|
54
|
+
if (module.program === undefined)
|
|
55
|
+
return;
|
|
56
|
+
const resolve = (name, namespace, expected) => {
|
|
57
|
+
const where = name.type === 'qualifiedIdentifier' ? name.namespace.value : namespace;
|
|
58
|
+
if (name.type === 'qualifiedIdentifier' && !hasNamespace(module, where)) {
|
|
59
|
+
report(error('unknown-namespace', `There is no namespace called ${where} in this module, so ${describeName(name)} can't be found.`, name.namespace.position));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const candidates = symbolsNamed(module, where, name.type === 'qualifiedIdentifier' ? name.name.value : name.value);
|
|
63
|
+
const symbol = candidates.find((candidate) => fits(candidate, expected));
|
|
64
|
+
if (symbol !== undefined) {
|
|
65
|
+
references.set(name, symbol);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const other = candidates[0];
|
|
69
|
+
if (other === undefined) {
|
|
70
|
+
report(error('unknown-name', `There is no ${ARTICLE[expected].replace(/^an? /, '')} called ${describeName(name)} in namespace ${where}.`, name.position));
|
|
71
|
+
}
|
|
72
|
+
else if (expected === 'value type' && other.typeKind === 'error') {
|
|
73
|
+
report(error('error-as-type', `${describeName(name)} is an error, so it can't be the type of a value. An error only reaches a caller through an action's \`raises\` or \`passes\` clause.`, name.position));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
report(error('wrong-kind', `${describeName(name)} is ${describeSymbol(other)}, but ${ARTICLE[expected]} is needed here.`, name.position));
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const resolveType = (type, namespace, expected = 'value type') => {
|
|
80
|
+
switch (type.type) {
|
|
81
|
+
case 'identifier':
|
|
82
|
+
case 'qualifiedIdentifier':
|
|
83
|
+
resolve(type, namespace, expected);
|
|
84
|
+
break;
|
|
85
|
+
case 'arrayType':
|
|
86
|
+
case 'setType':
|
|
87
|
+
resolveType(type.elementType, namespace);
|
|
88
|
+
break;
|
|
89
|
+
case 'mapType':
|
|
90
|
+
resolveType(type.valueType, namespace);
|
|
91
|
+
break;
|
|
92
|
+
default:
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
// Find the names inside expressions and statements that aren't local: the types after
|
|
97
|
+
// `instanceOf`, the errors in `raise` statements and the entities in `@subject is <type>`.
|
|
98
|
+
const walk = (node, namespace) => {
|
|
99
|
+
if (Array.isArray(node)) {
|
|
100
|
+
for (const child of node)
|
|
101
|
+
walk(child, namespace);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (typeof node !== 'object' || node === null)
|
|
105
|
+
return;
|
|
106
|
+
const typed = node;
|
|
107
|
+
switch (typed.type) {
|
|
108
|
+
case 'instanceOf': {
|
|
109
|
+
const target = typed.target;
|
|
110
|
+
if (target.type !== 'errorType')
|
|
111
|
+
resolveType(target, namespace, 'type');
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
case 'raise':
|
|
115
|
+
resolve(typed.error, namespace, 'error');
|
|
116
|
+
break;
|
|
117
|
+
case 'isPredicate': {
|
|
118
|
+
const subjectType = typed.subjectType;
|
|
119
|
+
if (subjectType.type === 'identifier')
|
|
120
|
+
resolve(subjectType, namespace, 'entity');
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
default:
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
for (const [key, value] of Object.entries(typed)) {
|
|
127
|
+
if (key !== 'position' && typeof value === 'object')
|
|
128
|
+
walk(value, namespace);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
let namespace = MAIN_NAMESPACE;
|
|
132
|
+
for (const declaration of module.program.children) {
|
|
133
|
+
switch (declaration.type) {
|
|
134
|
+
case 'namespace':
|
|
135
|
+
namespace = declaration.name.value;
|
|
136
|
+
break;
|
|
137
|
+
case 'action': {
|
|
138
|
+
for (const parameter of declaration.parameters) {
|
|
139
|
+
resolveType(parameter.valueType, namespace);
|
|
140
|
+
walk(parameter.defaultValue, namespace);
|
|
141
|
+
}
|
|
142
|
+
if (declaration.returnType.type !== 'voidType')
|
|
143
|
+
resolveType(declaration.returnType, namespace);
|
|
144
|
+
for (const name of declaration.raises)
|
|
145
|
+
resolve(name, namespace, 'error');
|
|
146
|
+
for (const name of declaration.passes)
|
|
147
|
+
if (name.type !== 'builtIn')
|
|
148
|
+
resolve(name, namespace, 'error');
|
|
149
|
+
if (declaration.native !== undefined)
|
|
150
|
+
checkNative(module, declaration.native, report);
|
|
151
|
+
walk(declaration.children, namespace);
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
case 'const':
|
|
155
|
+
if (declaration.valueType !== undefined)
|
|
156
|
+
resolveType(declaration.valueType, namespace);
|
|
157
|
+
walk(declaration.value, namespace);
|
|
158
|
+
break;
|
|
159
|
+
case 'model':
|
|
160
|
+
for (const field of declaration.fields) {
|
|
161
|
+
resolveType(field.valueType, namespace);
|
|
162
|
+
walk(field.defaultValue, namespace);
|
|
163
|
+
}
|
|
164
|
+
break;
|
|
165
|
+
case 'errorDeclaration':
|
|
166
|
+
if (Array.isArray(declaration.data)) {
|
|
167
|
+
for (const field of declaration.data) {
|
|
168
|
+
resolveType(field.valueType, namespace);
|
|
169
|
+
walk(field.defaultValue, namespace);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
else if (declaration.data !== undefined) {
|
|
173
|
+
resolve(declaration.data, namespace, 'model');
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
case 'entity':
|
|
177
|
+
for (const line of declaration.lines) {
|
|
178
|
+
if (line.type === 'modelsBlock')
|
|
179
|
+
for (const model of line.models)
|
|
180
|
+
resolve(model, namespace, 'model');
|
|
181
|
+
}
|
|
182
|
+
break;
|
|
183
|
+
case 'relation':
|
|
184
|
+
resolve(declaration.left.entity, namespace, 'entity');
|
|
185
|
+
resolve(declaration.right.entity, namespace, 'entity');
|
|
186
|
+
break;
|
|
187
|
+
case 'trigger':
|
|
188
|
+
resolve(declaration.action, namespace, 'action');
|
|
189
|
+
walk([declaration.auth, declaration.arguments, declaration.parameters, declaration.assertions], namespace);
|
|
190
|
+
break;
|
|
191
|
+
default:
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
/** A native action's module must be a local file (docs/adr/0031-module-resolution.md). */
|
|
197
|
+
function checkNative(module, native, report) {
|
|
198
|
+
const url = native.parts.map((part) => (part.type === 'text' ? part.value : '')).join('');
|
|
199
|
+
if (fileFromUrl(module.path, url) === undefined) {
|
|
200
|
+
report(error('remote-module', `"${url}" isn't a local file. A native action's module must be read from a file, not a remote URL.`, native.position));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../src/resolve.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,KAAK,EAAmB,MAAM,iBAAiB,CAAC;AACzD,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;gBACvG,CAAC;gBACD,MAAM;YACR,KAAK,UAAU;gBACb,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;gBACtD,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;gBACvD,MAAM;YACR,KAAK,SAAS;gBACZ,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;gBACjD,IAAI,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,SAAS,EAAE,WAAW,CAAC,UAAU,EAAE,WAAW,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC,CAAC;gBAC3G,MAAM;YACR;gBACE,MAAM;QACV,CAAC;IACH,CAAC;AACH,CAAC;AAED,0FAA0F;AAC1F,SAAS,WAAW,CAClB,MAAc,EACd,MAAqB,EACrB,MAAwC;IAExC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC1F,IAAI,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,SAAS,EAAE,CAAC;QAChD,MAAM,CACJ,KAAK,CACH,eAAe,EACf,IAAI,GAAG,4FAA4F,EACnG,MAAM,CAAC,QAAQ,CAChB,CACF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/stdlib.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The modules of the `cant` scope, which are built into the interpreter
|
|
3
|
+
* (docs/adr/0031-module-resolution.md). They are native modules whose declarations can use
|
|
4
|
+
* internal types that Cant source can't write (docs/adr/0036-native-modules.md), so the compiler
|
|
5
|
+
* describes them here, by the names they export, rather than reading them from Cant files.
|
|
6
|
+
*
|
|
7
|
+
* Only names are listed for now: their signatures arrive with type checking.
|
|
8
|
+
*/
|
|
9
|
+
/** What a standard library module exports a name as. */
|
|
10
|
+
export type StandardKind = 'action' | 'error';
|
|
11
|
+
export declare const STANDARD_LIBRARY: ReadonlyMap<string, ReadonlyMap<string, StandardKind>>;
|
|
12
|
+
//# sourceMappingURL=stdlib.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdlib.d.ts","sourceRoot":"","sources":["../src/stdlib.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,wDAAwD;AACxD,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE9C,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CA4BlF,CAAC"}
|