parser-lr 0.6.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -30
- package/bin/parser-lr.js +12759 -13493
- package/bin/parser-lr.js.map +1 -1
- package/dist/lib/grammar/grammar-from-cst.js +4 -1
- package/dist/lib/grammar/grammar-from-cst.js.map +1 -1
- package/dist/lib/grammar/grammar.json +86 -820
- package/dist/lib/grammar/index.d.ts +1 -1
- package/dist/lib/grammar/index.d.ts.map +1 -1
- package/dist/lib/grammar/index.js +1 -1
- package/dist/lib/grammar/index.js.map +1 -1
- package/dist/lib/grammar/meta-grammar-table.d.ts +0 -12
- package/dist/lib/grammar/meta-grammar-table.d.ts.map +1 -1
- package/dist/lib/grammar/meta-grammar-table.js +5 -22
- package/dist/lib/grammar/meta-grammar-table.js.map +1 -1
- package/dist/lib/grammar/table-validator.d.ts.map +1 -1
- package/dist/lib/grammar/table-validator.js +19 -1
- package/dist/lib/grammar/table-validator.js.map +1 -1
- package/dist/lib/grammar-entry.d.ts +42 -0
- package/dist/lib/grammar-entry.d.ts.map +1 -0
- package/dist/lib/grammar-entry.js +45 -0
- package/dist/lib/grammar-entry.js.map +1 -0
- package/dist/lib/index.d.ts +7 -5
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +0 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/parse-context.d.ts +4 -15
- package/dist/lib/parse-context.d.ts.map +1 -1
- package/dist/lib/parse-context.js +4 -23
- package/dist/lib/parse-context.js.map +1 -1
- package/dist/lib/transform/grammar-fixture.js +3 -3
- package/dist/lib/transform/grammar-fixture.js.map +1 -1
- package/docs/The Ferrite Programming Language.md +568 -0
- package/docs/grammar.md +55 -3
- package/docs/parser-lr-browser-lib-split.md +174 -0
- package/grammars/6502.grammar +2 -2
- package/grammars/ferrite.grammar +107 -97
- package/grammars/grammar.grammar +19 -140
- package/grammars/lisp.grammar +3 -2
- package/package.json +7 -2
- package/dist/lib/grammar/grammar-json-path.d.ts +0 -2
- package/dist/lib/grammar/grammar-json-path.d.ts.map +0 -1
- package/dist/lib/grammar/grammar-json-path.esm.d.ts +0 -5
- package/dist/lib/grammar/grammar-json-path.esm.d.ts.map +0 -1
- package/dist/lib/grammar/grammar-json-path.esm.js +0 -9
- package/dist/lib/grammar/grammar-json-path.esm.js.map +0 -1
- package/dist/lib/grammar/grammar-json-path.js +0 -2
- package/dist/lib/grammar/grammar-json-path.js.map +0 -1
- package/dist/lib-cjs/ast/ast-node.js +0 -70
- package/dist/lib-cjs/ast/ast-node.js.map +0 -1
- package/dist/lib-cjs/errors/index.js +0 -9
- package/dist/lib-cjs/errors/index.js.map +0 -1
- package/dist/lib-cjs/errors/parser-lr-error.js +0 -52
- package/dist/lib-cjs/errors/parser-lr-error.js.map +0 -1
- package/dist/lib-cjs/grammar/ast-schema.js +0 -43
- package/dist/lib-cjs/grammar/ast-schema.js.map +0 -1
- package/dist/lib-cjs/grammar/ast-type.js +0 -3
- package/dist/lib-cjs/grammar/ast-type.js.map +0 -1
- package/dist/lib-cjs/grammar/expression.js +0 -3
- package/dist/lib-cjs/grammar/expression.js.map +0 -1
- package/dist/lib-cjs/grammar/grammar-from-cst.js +0 -641
- package/dist/lib-cjs/grammar/grammar-from-cst.js.map +0 -1
- package/dist/lib-cjs/grammar/grammar-json-path.js +0 -13
- package/dist/lib-cjs/grammar/grammar-json-path.js.map +0 -1
- package/dist/lib-cjs/grammar/grammar-literals.js +0 -71
- package/dist/lib-cjs/grammar/grammar-literals.js.map +0 -1
- package/dist/lib-cjs/grammar/grammar.js +0 -64
- package/dist/lib-cjs/grammar/grammar.js.map +0 -1
- package/dist/lib-cjs/grammar/grammar.json +0 -5760
- package/dist/lib-cjs/grammar/index.js +0 -21
- package/dist/lib-cjs/grammar/index.js.map +0 -1
- package/dist/lib-cjs/grammar/meta-grammar-table.js +0 -68
- package/dist/lib-cjs/grammar/meta-grammar-table.js.map +0 -1
- package/dist/lib-cjs/grammar/production.js +0 -3
- package/dist/lib-cjs/grammar/production.js.map +0 -1
- package/dist/lib-cjs/grammar/read-grammar-error.js +0 -22
- package/dist/lib-cjs/grammar/read-grammar-error.js.map +0 -1
- package/dist/lib-cjs/grammar/read-grammar.js +0 -24
- package/dist/lib-cjs/grammar/read-grammar.js.map +0 -1
- package/dist/lib-cjs/grammar/table-validator.js +0 -262
- package/dist/lib-cjs/grammar/table-validator.js.map +0 -1
- package/dist/lib-cjs/grammar/token-rule.js +0 -3
- package/dist/lib-cjs/grammar/token-rule.js.map +0 -1
- package/dist/lib-cjs/grammar/transform-expression.js +0 -3
- package/dist/lib-cjs/grammar/transform-expression.js.map +0 -1
- package/dist/lib-cjs/grammar/transform-rule.js +0 -3
- package/dist/lib-cjs/grammar/transform-rule.js.map +0 -1
- package/dist/lib-cjs/grammar/transform-schema.js +0 -43
- package/dist/lib-cjs/grammar/transform-schema.js.map +0 -1
- package/dist/lib-cjs/index.js +0 -66
- package/dist/lib-cjs/index.js.map +0 -1
- package/dist/lib-cjs/lexer/index.js +0 -32
- package/dist/lib-cjs/lexer/index.js.map +0 -1
- package/dist/lib-cjs/lexer/lexer-compile-error.js +0 -22
- package/dist/lib-cjs/lexer/lexer-compile-error.js.map +0 -1
- package/dist/lib-cjs/lexer/lexer-compile.js +0 -201
- package/dist/lib-cjs/lexer/lexer-compile.js.map +0 -1
- package/dist/lib-cjs/lexer/lexer-error.js +0 -22
- package/dist/lib-cjs/lexer/lexer-error.js.map +0 -1
- package/dist/lib-cjs/lexer/lexer-input-error.js +0 -17
- package/dist/lib-cjs/lexer/lexer-input-error.js.map +0 -1
- package/dist/lib-cjs/lexer/lexer-state-error.js +0 -19
- package/dist/lib-cjs/lexer/lexer-state-error.js.map +0 -1
- package/dist/lib-cjs/lexer/lexer.js +0 -278
- package/dist/lib-cjs/lexer/lexer.js.map +0 -1
- package/dist/lib-cjs/lexer/token.js +0 -44
- package/dist/lib-cjs/lexer/token.js.map +0 -1
- package/dist/lib-cjs/package.json +0 -3
- package/dist/lib-cjs/parse-context-error.js +0 -19
- package/dist/lib-cjs/parse-context-error.js.map +0 -1
- package/dist/lib-cjs/parse-context.js +0 -137
- package/dist/lib-cjs/parse-context.js.map +0 -1
- package/dist/lib-cjs/parse-output-error.js +0 -19
- package/dist/lib-cjs/parse-output-error.js.map +0 -1
- package/dist/lib-cjs/parse-output.js +0 -18
- package/dist/lib-cjs/parse-output.js.map +0 -1
- package/dist/lib-cjs/parse-table/analysis/first-follow.js +0 -294
- package/dist/lib-cjs/parse-table/analysis/first-follow.js.map +0 -1
- package/dist/lib-cjs/parse-table/analysis/index.js +0 -9
- package/dist/lib-cjs/parse-table/analysis/index.js.map +0 -1
- package/dist/lib-cjs/parse-table/bnf/bnf-grammar.js +0 -140
- package/dist/lib-cjs/parse-table/bnf/bnf-grammar.js.map +0 -1
- package/dist/lib-cjs/parse-table/bnf/bnf-production.js +0 -3
- package/dist/lib-cjs/parse-table/bnf/bnf-production.js.map +0 -1
- package/dist/lib-cjs/parse-table/bnf/bnf-symbol.js +0 -39
- package/dist/lib-cjs/parse-table/bnf/bnf-symbol.js.map +0 -1
- package/dist/lib-cjs/parse-table/bnf/desugar-ebnf.js +0 -224
- package/dist/lib-cjs/parse-table/bnf/desugar-ebnf.js.map +0 -1
- package/dist/lib-cjs/parse-table/bnf/index.js +0 -13
- package/dist/lib-cjs/parse-table/bnf/index.js.map +0 -1
- package/dist/lib-cjs/parse-table/build-lr-table.js +0 -171
- package/dist/lib-cjs/parse-table/build-lr-table.js.map +0 -1
- package/dist/lib-cjs/parse-table/index.js +0 -49
- package/dist/lib-cjs/parse-table/index.js.map +0 -1
- package/dist/lib-cjs/parse-table/lr-algorithm-error.js +0 -19
- package/dist/lib-cjs/parse-table/lr-algorithm-error.js.map +0 -1
- package/dist/lib-cjs/parse-table/lr-algorithm.js +0 -31
- package/dist/lib-cjs/parse-table/lr-algorithm.js.map +0 -1
- package/dist/lib-cjs/parse-table/lr0/index.js +0 -14
- package/dist/lib-cjs/parse-table/lr0/index.js.map +0 -1
- package/dist/lib-cjs/parse-table/lr0/lr0-item-set.js +0 -286
- package/dist/lib-cjs/parse-table/lr0/lr0-item-set.js.map +0 -1
- package/dist/lib-cjs/parse-table/lr1/index.js +0 -18
- package/dist/lib-cjs/parse-table/lr1/index.js.map +0 -1
- package/dist/lib-cjs/parse-table/lr1/lr1-item-set.js +0 -432
- package/dist/lib-cjs/parse-table/lr1/lr1-item-set.js.map +0 -1
- package/dist/lib-cjs/parse-table/parse-table-build-error.js +0 -24
- package/dist/lib-cjs/parse-table/parse-table-build-error.js.map +0 -1
- package/dist/lib-cjs/parse-table/parse-table-error.js +0 -19
- package/dist/lib-cjs/parse-table/parse-table-error.js.map +0 -1
- package/dist/lib-cjs/parse-table/parse-table-json.js +0 -12
- package/dist/lib-cjs/parse-table/parse-table-json.js.map +0 -1
- package/dist/lib-cjs/parse-table/parse-table.js +0 -345
- package/dist/lib-cjs/parse-table/parse-table.js.map +0 -1
- package/dist/lib-cjs/parse-table/slr/index.js +0 -13
- package/dist/lib-cjs/parse-table/slr/index.js.map +0 -1
- package/dist/lib-cjs/parse-table/slr/parse-action.js +0 -8
- package/dist/lib-cjs/parse-table/slr/parse-action.js.map +0 -1
- package/dist/lib-cjs/parse-table/slr/slr-table.js +0 -18
- package/dist/lib-cjs/parse-table/slr/slr-table.js.map +0 -1
- package/dist/lib-cjs/parse-table/table/index.js +0 -21
- package/dist/lib-cjs/parse-table/table/index.js.map +0 -1
- package/dist/lib-cjs/parse-table/table/lr-parse-table.js +0 -192
- package/dist/lib-cjs/parse-table/table/lr-parse-table.js.map +0 -1
- package/dist/lib-cjs/parse-table/table/parse-action.js +0 -54
- package/dist/lib-cjs/parse-table/table/parse-action.js.map +0 -1
- package/dist/lib-cjs/parse-table/table/table-builder-base.js +0 -153
- package/dist/lib-cjs/parse-table/table/table-builder-base.js.map +0 -1
- package/dist/lib-cjs/parse-table/token-inventory.js +0 -18
- package/dist/lib-cjs/parse-table/token-inventory.js.map +0 -1
- package/dist/lib-cjs/parser-lr.js +0 -143
- package/dist/lib-cjs/parser-lr.js.map +0 -1
- package/dist/lib-cjs/shift-reduce/index.js +0 -11
- package/dist/lib-cjs/shift-reduce/index.js.map +0 -1
- package/dist/lib-cjs/shift-reduce/shift-reduce-engine.js +0 -224
- package/dist/lib-cjs/shift-reduce/shift-reduce-engine.js.map +0 -1
- package/dist/lib-cjs/transform/binding-map.js +0 -82
- package/dist/lib-cjs/transform/binding-map.js.map +0 -1
- package/dist/lib-cjs/transform/cst-transformer.js +0 -480
- package/dist/lib-cjs/transform/cst-transformer.js.map +0 -1
- package/dist/lib-cjs/transform/grammar-fixture.js +0 -109
- package/dist/lib-cjs/transform/grammar-fixture.js.map +0 -1
- package/dist/lib-cjs/transform/index.js +0 -12
- package/dist/lib-cjs/transform/index.js.map +0 -1
- package/docs/parser-lr-enhancement-proposals.md +0 -337
- package/grammars/fixtures/table-only-import/table-only-smoke.cjs +0 -38
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseActionsEqual = parseActionsEqual;
|
|
4
|
-
exports.formatParseAction = formatParseAction;
|
|
5
|
-
exports.classifyParseConflict = classifyParseConflict;
|
|
6
|
-
/**
|
|
7
|
-
* Returns whether two parse actions are identical.
|
|
8
|
-
*
|
|
9
|
-
* @param left - First action.
|
|
10
|
-
* @param right - Second action.
|
|
11
|
-
*/
|
|
12
|
-
function parseActionsEqual(left, right) {
|
|
13
|
-
if (left.kind !== right.kind) {
|
|
14
|
-
return false;
|
|
15
|
-
}
|
|
16
|
-
switch (left.kind) {
|
|
17
|
-
case 'shift':
|
|
18
|
-
return right.kind === 'shift' && left.state === right.state;
|
|
19
|
-
case 'reduce':
|
|
20
|
-
return right.kind === 'reduce' && left.productionId === right.productionId;
|
|
21
|
-
case 'accept':
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Returns a readable parse action label for tests and diagnostics.
|
|
27
|
-
*
|
|
28
|
-
* @param action - Parse action to format.
|
|
29
|
-
*/
|
|
30
|
-
function formatParseAction(action) {
|
|
31
|
-
switch (action.kind) {
|
|
32
|
-
case 'shift':
|
|
33
|
-
return `s${String(action.state)}`;
|
|
34
|
-
case 'reduce':
|
|
35
|
-
return `r${String(action.productionId)}`;
|
|
36
|
-
case 'accept':
|
|
37
|
-
return 'acc';
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Classifies a conflict between two distinct parse actions.
|
|
42
|
-
*
|
|
43
|
-
* @param existing - Action already recorded for the table slot.
|
|
44
|
-
* @param incoming - New action competing for the same slot.
|
|
45
|
-
*/
|
|
46
|
-
function classifyParseConflict(existing, incoming) {
|
|
47
|
-
const existingIsShift = existing.kind === 'shift';
|
|
48
|
-
const incomingIsShift = incoming.kind === 'shift';
|
|
49
|
-
if (existingIsShift !== incomingIsShift) {
|
|
50
|
-
return 'shift-reduce';
|
|
51
|
-
}
|
|
52
|
-
return 'reduce-reduce';
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=parse-action.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse-action.js","sourceRoot":"","sources":["../../../../src/lib/parse-table/table/parse-action.ts"],"names":[],"mappings":";;AAyCA,8CAkBC;AAOD,8CAaC;AAQD,sDAcC;AAlED;;;;;GAKG;AACH,SAAgB,iBAAiB,CAAC,IAAiB,EAAE,KAAkB;IAEnE,IAAI,IAAI,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,EAC5B,CAAC;QACG,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,QAAQ,IAAI,CAAC,IAAI,EACjB,CAAC;QACG,KAAK,OAAO;YACR,OAAO,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,CAAC;QAEhE,KAAK,QAAQ;YACT,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,YAAY,CAAC;QAE/E,KAAK,QAAQ;YACT,OAAO,IAAI,CAAC;IACpB,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,MAAmB;IAEjD,QAAQ,MAAM,CAAC,IAAI,EACnB,CAAC;QACG,KAAK,OAAO;YACR,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAEtC,KAAK,QAAQ;YACT,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QAE7C,KAAK,QAAQ;YACT,OAAO,KAAK,CAAC;IACrB,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,SAAgB,qBAAqB,CACjC,QAAqB,EACrB,QAAqB;IAGrB,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;IAClD,MAAM,eAAe,GAAG,QAAQ,CAAC,IAAI,KAAK,OAAO,CAAC;IAElD,IAAI,eAAe,KAAK,eAAe,EACvC,CAAC;QACG,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,OAAO,eAAe,CAAC;AAC3B,CAAC"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TableBuilderBase = void 0;
|
|
4
|
-
const token_js_1 = require("../../lexer/token.js");
|
|
5
|
-
const bnf_grammar_js_1 = require("../bnf/bnf-grammar.js");
|
|
6
|
-
const bnf_symbol_js_1 = require("../bnf/bnf-symbol.js");
|
|
7
|
-
const lr0_item_set_js_1 = require("../lr0/lr0-item-set.js");
|
|
8
|
-
const parse_action_js_1 = require("./parse-action.js");
|
|
9
|
-
/**
|
|
10
|
-
* Shared helpers for constructing LR parse tables from item sets.
|
|
11
|
-
*/
|
|
12
|
-
class TableBuilderBase {
|
|
13
|
-
/**
|
|
14
|
-
* Precomputes GOTO target state indices for every state and grammar symbol.
|
|
15
|
-
*
|
|
16
|
-
* @param grammar - Augmented BNF grammar.
|
|
17
|
-
* @param itemSets - Canonical item set collection.
|
|
18
|
-
* @param gotoItems - Computes the GOTO item set for one state and symbol.
|
|
19
|
-
* @returns Map from `state:symbol` keys to target state indices.
|
|
20
|
-
*/
|
|
21
|
-
static buildGotoTargets(grammar, itemSets, indexOf, gotoItems) {
|
|
22
|
-
const targets = new Map();
|
|
23
|
-
// Precompute GOTO for every state and symbol reachable from its items.
|
|
24
|
-
for (let state = 0; state < itemSets.length; state += 1) {
|
|
25
|
-
const itemSet = itemSets[state] ?? [];
|
|
26
|
-
for (const symbolKey of (0, lr0_item_set_js_1.symbolsAfterDot)(grammar, itemSet)) {
|
|
27
|
-
const gotoSet = gotoItems(grammar, itemSet, symbolKey);
|
|
28
|
-
if (gotoSet.length === 0) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
const targetState = indexOf(gotoSet);
|
|
32
|
-
if (targetState === null) {
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
targets.set(TableBuilderBase.gotoKey(state, symbolKey), targetState);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return targets;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Fills shift and GOTO entries from incomplete items in one parser state.
|
|
42
|
-
*
|
|
43
|
-
* @param grammar - Augmented BNF grammar.
|
|
44
|
-
* @param state - Parser state index.
|
|
45
|
-
* @param itemSet - Closed item set for the state.
|
|
46
|
-
* @param gotoTargets - Precomputed GOTO target indices.
|
|
47
|
-
* @param stateActions - ACTION map for the state.
|
|
48
|
-
* @param stateGotos - GOTO map for the state.
|
|
49
|
-
* @param conflicts - Resolved conflict list to append to when actions disagree.
|
|
50
|
-
*/
|
|
51
|
-
static fillShiftsAndGotos(grammar, state, itemSet, gotoTargets, stateActions, stateGotos, conflicts) {
|
|
52
|
-
// Derive shift and GOTO entries from every incomplete item in the state.
|
|
53
|
-
for (const item of itemSet) {
|
|
54
|
-
const production = grammar.production(item.productionId);
|
|
55
|
-
if (production === null) {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
const nextSymbol = production.rhs[item.dot];
|
|
59
|
-
if (nextSymbol === undefined) {
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
const symbolKey = (0, bnf_symbol_js_1.bnfParserSymbolKey)(nextSymbol);
|
|
63
|
-
const targetState = gotoTargets.get(TableBuilderBase.gotoKey(state, symbolKey));
|
|
64
|
-
if (targetState === undefined) {
|
|
65
|
-
continue;
|
|
66
|
-
}
|
|
67
|
-
// Non-terminal symbols populate GOTO; terminals populate ACTION shift entries.
|
|
68
|
-
if (nextSymbol.kind === 'nonTerminal') {
|
|
69
|
-
stateGotos.set(nextSymbol.name, targetState);
|
|
70
|
-
continue;
|
|
71
|
-
}
|
|
72
|
-
TableBuilderBase.setAction(stateActions, conflicts, state, symbolKey, { kind: 'shift', state: targetState });
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Records an accept action for the augmented start production.
|
|
77
|
-
*
|
|
78
|
-
* @param state - Parser state index.
|
|
79
|
-
* @param productionName - Left-hand side of the completed production.
|
|
80
|
-
* @param stateActions - ACTION map for the state.
|
|
81
|
-
* @param conflicts - Resolved conflict list to append to when actions disagree.
|
|
82
|
-
*/
|
|
83
|
-
static setAcceptAction(state, productionName, stateActions, conflicts) {
|
|
84
|
-
if (productionName !== bnf_grammar_js_1.AUGMENTED_START_SYMBOL) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
TableBuilderBase.setAction(stateActions, conflicts, state, token_js_1.EOF_TOKEN_NAME, { kind: 'accept' });
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Returns a stable map key for a GOTO lookup.
|
|
91
|
-
*
|
|
92
|
-
* @param state - Parser state index.
|
|
93
|
-
* @param symbolKey - Encoded terminal or non-terminal symbol.
|
|
94
|
-
*/
|
|
95
|
-
static gotoKey(state, symbolKey) {
|
|
96
|
-
return `${String(state)}:${symbolKey}`;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Inserts one ACTION entry, resolving shift/reduce and reduce/reduce conflicts.
|
|
100
|
-
*
|
|
101
|
-
* @param stateActions - ACTION map for the current state.
|
|
102
|
-
* @param conflicts - Resolved conflict list to append to when actions disagree.
|
|
103
|
-
* @param state - Parser state index.
|
|
104
|
-
* @param symbol - Encoded terminal or `$eof` key.
|
|
105
|
-
* @param incoming - Candidate parse action.
|
|
106
|
-
*/
|
|
107
|
-
static setAction(stateActions, conflicts, state, symbol, incoming) {
|
|
108
|
-
const existing = stateActions.get(symbol);
|
|
109
|
-
if (existing === undefined) {
|
|
110
|
-
stateActions.set(symbol, incoming);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
// Identical re-insertions are ignored; disagreeing actions are resolved by conflict kind.
|
|
114
|
-
if ((0, parse_action_js_1.parseActionsEqual)(existing, incoming)) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const conflictKind = (0, parse_action_js_1.classifyParseConflict)(existing, incoming);
|
|
118
|
-
if (conflictKind === 'shift-reduce') {
|
|
119
|
-
const shiftAction = existing.kind === 'shift' ? existing : incoming;
|
|
120
|
-
stateActions.set(symbol, shiftAction);
|
|
121
|
-
conflicts.push({
|
|
122
|
-
kind: 'shift-reduce',
|
|
123
|
-
state,
|
|
124
|
-
symbol,
|
|
125
|
-
existing,
|
|
126
|
-
incoming,
|
|
127
|
-
resolution: 'shift',
|
|
128
|
-
});
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
// Reduce/reduce: keep the first reduce action already in the table.
|
|
132
|
-
conflicts.push({
|
|
133
|
-
kind: 'reduce-reduce',
|
|
134
|
-
state,
|
|
135
|
-
symbol,
|
|
136
|
-
existing,
|
|
137
|
-
incoming,
|
|
138
|
-
resolution: 'reduce',
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Default GOTO implementation for LR(0) item sets.
|
|
143
|
-
*
|
|
144
|
-
* @param grammar - Augmented BNF grammar.
|
|
145
|
-
* @param items - Closed item set.
|
|
146
|
-
* @param symbolKey - Encoded terminal or non-terminal symbol.
|
|
147
|
-
*/
|
|
148
|
-
static lr0GotoItems(grammar, items, symbolKey) {
|
|
149
|
-
return (0, lr0_item_set_js_1.lr0Goto)(grammar, items, symbolKey);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
exports.TableBuilderBase = TableBuilderBase;
|
|
153
|
-
//# sourceMappingURL=table-builder-base.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"table-builder-base.js","sourceRoot":"","sources":["../../../../src/lib/parse-table/table/table-builder-base.ts"],"names":[],"mappings":";;;AAAA,mDAAsD;AAEtD,0DAAgF;AAChF,wDAA0D;AAC1D,4DAAgF;AAEhF,uDAK2B;AAE3B;;GAEG;AACH,MAAa,gBAAgB;IAEzB;;;;;;;OAOG;IACI,MAAM,CAAC,gBAAgB,CAC1B,OAAmB,EACnB,QAAyC,EACzC,OAAqD,EACrD,SAIuB;QAGvB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;QAE1C,uEAAuE;QACvE,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EACvD,CAAC;YACG,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAEtC,KAAK,MAAM,SAAS,IAAI,IAAA,iCAAe,EAAC,OAAO,EAAE,OAAO,CAAC,EACzD,CAAC;gBACG,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;gBAEvD,IAAI,OAAO,CAAC,MAAM,KAAK,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pE,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;YACtC,SAAS,CAAC,IAAI,CAAC;gBACX,IAAI,EAAE,cAAc;gBACpB,KAAK;gBACL,MAAM;gBACN,QAAQ;gBACR,QAAQ;gBACR,UAAU,EAAE,OAAO;aACtB,CAAC,CAAC;YACH,OAAO;QACX,CAAC;QAED,oEAAoE;QACpE,SAAS,CAAC,IAAI,CAAC;YACX,IAAI,EAAE,eAAe;YACrB,KAAK;YACL,MAAM;YACN,QAAQ;YACR,QAAQ;YACR,UAAU,EAAE,QAAQ;SACvB,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,YAAY,CACtB,OAAmB,EACnB,KAAyB,EACzB,SAAiB;QAGjB,OAAO,IAAA,yBAAO,EAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC9C,CAAC;CACJ;AApOD,4CAoOC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tokenInventory = tokenInventory;
|
|
4
|
-
const token_js_1 = require("../lexer/token.js");
|
|
5
|
-
/**
|
|
6
|
-
* Returns the ordered token rule names declared in a grammar.
|
|
7
|
-
*
|
|
8
|
-
* @param grammar - Parsed `.grammar` file model.
|
|
9
|
-
* @returns Token names in declaration order, including `$eof`.
|
|
10
|
-
*/
|
|
11
|
-
function tokenInventory(grammar) {
|
|
12
|
-
const names = grammar.tokenRules.map((rule) => rule.name);
|
|
13
|
-
if (names.includes(token_js_1.EOF_TOKEN_NAME)) {
|
|
14
|
-
return names;
|
|
15
|
-
}
|
|
16
|
-
return [...names, token_js_1.EOF_TOKEN_NAME];
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=token-inventory.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"token-inventory.js","sourceRoot":"","sources":["../../../src/lib/parse-table/token-inventory.ts"],"names":[],"mappings":";;AASA,wCAUC;AAlBD,gDAAmD;AAEnD;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,OAAgB;IAE3C,MAAM,KAAK,GAAG,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE1D,IAAI,KAAK,CAAC,QAAQ,CAAC,yBAAc,CAAC,EAClC,CAAC;QACG,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,EAAE,yBAAc,CAAC,CAAC;AACtC,CAAC"}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ParserLr = void 0;
|
|
4
|
-
const lexer_js_1 = require("./lexer/lexer.js");
|
|
5
|
-
const parse_table_js_1 = require("./parse-table/parse-table.js");
|
|
6
|
-
const shift_reduce_engine_js_1 = require("./shift-reduce/shift-reduce-engine.js");
|
|
7
|
-
const cst_transformer_js_1 = require("./transform/cst-transformer.js");
|
|
8
|
-
/**
|
|
9
|
-
* Shift-reduce parser for EBNF grammars.
|
|
10
|
-
*/
|
|
11
|
-
class ParserLr {
|
|
12
|
-
grammar;
|
|
13
|
-
table;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a parser bound to a grammar and optional parse table.
|
|
16
|
-
*
|
|
17
|
-
* @param grammar - Parsed `.grammar` file supplying lexer and parser rules.
|
|
18
|
-
* @param table - Optional parse table used for shift-reduce parsing.
|
|
19
|
-
*/
|
|
20
|
-
constructor(grammar, table = null) {
|
|
21
|
-
this.grammar = grammar;
|
|
22
|
-
this.table = table;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Creates a parser from a serialized parse table.
|
|
26
|
-
*
|
|
27
|
-
* @param table - Parse table containing lexer metadata, parser entries, and optional AST transforms.
|
|
28
|
-
* @returns A parser that lexes, parses, and applies transforms from the table JSON.
|
|
29
|
-
*/
|
|
30
|
-
static fromParseTable(table) {
|
|
31
|
-
return new ParserLr(table.toGrammar(), table);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Creates a stream lexer for this parser's grammar.
|
|
35
|
-
*
|
|
36
|
-
* @returns A fresh stream lexer instance.
|
|
37
|
-
*/
|
|
38
|
-
createLexer() {
|
|
39
|
-
return new lexer_js_1.Lexer(this.grammar);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Lexes source text into tokens using the grammar's token and skip rules.
|
|
43
|
-
*
|
|
44
|
-
* @param source - Input text to tokenize.
|
|
45
|
-
* @returns Matched tokens in source order, ending with `$eof`.
|
|
46
|
-
*/
|
|
47
|
-
lex(source) {
|
|
48
|
-
return this.createLexer().lex(source);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Lexes synchronous source chunks into a token stream ending with `$eof`.
|
|
52
|
-
*
|
|
53
|
-
* @param chunks - Source text fragments in order.
|
|
54
|
-
* @returns Token iterator including `$eof`.
|
|
55
|
-
*/
|
|
56
|
-
lexChunks(chunks) {
|
|
57
|
-
return (0, lexer_js_1.lexChunks)(this.grammar, chunks);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Lexes asynchronous source chunks into a token stream ending with `$eof`.
|
|
61
|
-
*
|
|
62
|
-
* @param chunks - Source text fragments in order.
|
|
63
|
-
* @returns Async token iterator including `$eof`.
|
|
64
|
-
*/
|
|
65
|
-
lexChunksAsync(chunks) {
|
|
66
|
-
return (0, lexer_js_1.lexChunksAsync)(this.grammar, chunks);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Collects all tokens from a synchronous chunk stream.
|
|
70
|
-
*
|
|
71
|
-
* @param chunks - Source text fragments in order.
|
|
72
|
-
* @returns Matched tokens including `$eof`.
|
|
73
|
-
*/
|
|
74
|
-
lexChunkStream(chunks) {
|
|
75
|
-
return (0, lexer_js_1.lexChunkStream)(this.grammar, chunks);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Collects all tokens from an asynchronous chunk stream.
|
|
79
|
-
*
|
|
80
|
-
* @param chunks - Source text fragments in order.
|
|
81
|
-
* @returns Matched tokens including `$eof`.
|
|
82
|
-
*/
|
|
83
|
-
async lexChunkStreamAsync(chunks) {
|
|
84
|
-
return (0, lexer_js_1.lexChunkStreamAsync)(this.grammar, chunks);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Parses a token stream into a concrete syntax tree.
|
|
88
|
-
*
|
|
89
|
-
* @param tokens - Token stream ending with `$eof`.
|
|
90
|
-
* @returns Parse tree rooted at the grammar start symbol, or null on syntax error.
|
|
91
|
-
*/
|
|
92
|
-
parseCst(tokens) {
|
|
93
|
-
if (this.table === null) {
|
|
94
|
-
return null;
|
|
95
|
-
}
|
|
96
|
-
return (0, shift_reduce_engine_js_1.parseWithTable)(this.table, tokens);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Parses a token stream into an AST when transform rules are declared.
|
|
100
|
-
*
|
|
101
|
-
* @param tokens - Token stream ending with `$eof`.
|
|
102
|
-
* @returns Transformed AST, CST when no transform section exists, or null on failure.
|
|
103
|
-
*/
|
|
104
|
-
parseAst(tokens) {
|
|
105
|
-
const cst = this.parseCst(tokens);
|
|
106
|
-
if (cst === null) {
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
if (this.grammar.transformSchema === null || this.table === null) {
|
|
110
|
-
return cst;
|
|
111
|
-
}
|
|
112
|
-
return (0, cst_transformer_js_1.transformCst)(cst, this.grammar.transformSchema, this.table);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Parses a token stream, applying CST-to-AST transforms when configured.
|
|
116
|
-
*
|
|
117
|
-
* @param tokens - Token stream ending with `$eof`.
|
|
118
|
-
* @returns AST or CST parse tree, or null on syntax error.
|
|
119
|
-
*/
|
|
120
|
-
parse(tokens) {
|
|
121
|
-
return this.parseAst(tokens);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Lexes and parses source text, applying CST-to-AST transforms when configured.
|
|
125
|
-
*
|
|
126
|
-
* @param source - Input text to parse.
|
|
127
|
-
* @returns AST or CST parse tree, or null on syntax error.
|
|
128
|
-
*/
|
|
129
|
-
parseSource(source) {
|
|
130
|
-
return this.parse(this.lex(source));
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Builds a parse table from the bound grammar, including the token inventory.
|
|
134
|
-
*
|
|
135
|
-
* @param algorithm - LR algorithm used to build the table.
|
|
136
|
-
* @returns Parse table metadata ready for serialization.
|
|
137
|
-
*/
|
|
138
|
-
buildParseTable(algorithm = 'lr1') {
|
|
139
|
-
return parse_table_js_1.ParseTable.fromGrammar(this.grammar, algorithm);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
exports.ParserLr = ParserLr;
|
|
143
|
-
//# sourceMappingURL=parser-lr.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser-lr.js","sourceRoot":"","sources":["../../src/lib/parser-lr.ts"],"names":[],"mappings":";;;AAEA,+CAM0B;AAG1B,iEAA0D;AAC1D,kFAAuE;AACvE,uEAA8D;AAE9D;;GAEG;AACH,MAAa,QAAQ;IASG;IACC;IARrB;;;;;OAKG;IACH,YACoB,OAAgB,EACf,QAA2B,IAAI;QADhC,YAAO,GAAP,OAAO,CAAS;QACf,UAAK,GAAL,KAAK,CAA0B;IAGpD,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,cAAc,CAAC,KAAiB;QAE1C,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACI,WAAW;QAEd,OAAO,IAAI,gBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACI,GAAG,CAAC,MAAc;QAErB,OAAO,I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,CAAC;IACvE,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,MAAwB;QAEjC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACI,WAAW,CAAC,MAAc;QAE7B,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACI,eAAe,CAAC,YAAyB,KAAK;QAEjD,OAAO,2BAAU,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC3D,CAAC;CACJ;AAlKD,4BAkKC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tokenActionKey = exports.ShiftReduceEngine = exports.parseWithTableResult = exports.parseWithTable = exports.mergeChildLocations = exports.astNodeFromToken = void 0;
|
|
4
|
-
var shift_reduce_engine_js_1 = require("./shift-reduce-engine.js");
|
|
5
|
-
Object.defineProperty(exports, "astNodeFromToken", { enumerable: true, get: function () { return shift_reduce_engine_js_1.astNodeFromToken; } });
|
|
6
|
-
Object.defineProperty(exports, "mergeChildLocations", { enumerable: true, get: function () { return shift_reduce_engine_js_1.mergeChildLocations; } });
|
|
7
|
-
Object.defineProperty(exports, "parseWithTable", { enumerable: true, get: function () { return shift_reduce_engine_js_1.parseWithTable; } });
|
|
8
|
-
Object.defineProperty(exports, "parseWithTableResult", { enumerable: true, get: function () { return shift_reduce_engine_js_1.parseWithTableResult; } });
|
|
9
|
-
Object.defineProperty(exports, "ShiftReduceEngine", { enumerable: true, get: function () { return shift_reduce_engine_js_1.ShiftReduceEngine; } });
|
|
10
|
-
Object.defineProperty(exports, "tokenActionKey", { enumerable: true, get: function () { return shift_reduce_engine_js_1.tokenActionKey; } });
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/shift-reduce/index.ts"],"names":[],"mappings":";;;AAAA,mEAOkC;AAN9B,0HAAA,gBAAgB,OAAA;AAChB,6HAAA,mBAAmB,OAAA;AACnB,wHAAA,cAAc,OAAA;AACd,8HAAA,oBAAoB,OAAA;AACpB,2HAAA,iBAAiB,OAAA;AACjB,wHAAA,cAAc,OAAA"}
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ShiftReduceEngine = void 0;
|
|
4
|
-
exports.tokenActionKey = tokenActionKey;
|
|
5
|
-
exports.astNodeFromToken = astNodeFromToken;
|
|
6
|
-
exports.mergeChildLocations = mergeChildLocations;
|
|
7
|
-
exports.parseWithTable = parseWithTable;
|
|
8
|
-
exports.parseWithTableResult = parseWithTableResult;
|
|
9
|
-
const ast_node_js_1 = require("../ast/ast-node.js");
|
|
10
|
-
const token_js_1 = require("../lexer/token.js");
|
|
11
|
-
/**
|
|
12
|
-
* Returns the ACTION table key for a lexer token.
|
|
13
|
-
*
|
|
14
|
-
* @param token - Current input token.
|
|
15
|
-
* @returns The ACTION table key for the token, or `$eof` for end-of-input.
|
|
16
|
-
*/
|
|
17
|
-
function tokenActionKey(token) {
|
|
18
|
-
if ((0, token_js_1.isEofToken)(token)) {
|
|
19
|
-
return token_js_1.EOF_TOKEN_NAME;
|
|
20
|
-
}
|
|
21
|
-
return token.name;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Builds a terminal CST node from a shifted token.
|
|
25
|
-
*
|
|
26
|
-
* @param token - Lexer token that was shifted.
|
|
27
|
-
* @returns A terminal CST node carrying the token name, text, and location.
|
|
28
|
-
*/
|
|
29
|
-
function astNodeFromToken(token) {
|
|
30
|
-
return ast_node_js_1.AstNode.terminal(token.name, token.text, token.location);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Merges child spans into one source location.
|
|
34
|
-
*
|
|
35
|
-
* @param children - Reduced child subtrees.
|
|
36
|
-
* @returns The smallest span covering all child locations, or null when none exist.
|
|
37
|
-
*/
|
|
38
|
-
function mergeChildLocations(children) {
|
|
39
|
-
let offset = null;
|
|
40
|
-
let end = null;
|
|
41
|
-
// Walk children to find the earliest offset and latest end position.
|
|
42
|
-
for (const child of children) {
|
|
43
|
-
if (child.location === null) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
if (offset === null) {
|
|
47
|
-
offset = child.location.offset;
|
|
48
|
-
end = child.location.offset + child.location.length;
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
offset = Math.min(offset, child.location.offset);
|
|
52
|
-
end = Math.max(end ?? child.location.offset, child.location.offset + child.location.length);
|
|
53
|
-
}
|
|
54
|
-
if (offset === null || end === null) {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
offset,
|
|
59
|
-
length: end - offset,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Table-driven shift-reduce parser shared by all LR table algorithms.
|
|
64
|
-
*/
|
|
65
|
-
class ShiftReduceEngine {
|
|
66
|
-
/**
|
|
67
|
-
* Parses a token stream using a serialized LR parse table.
|
|
68
|
-
*
|
|
69
|
-
* @param table - Parse table with ACTION, GOTO, and production metadata.
|
|
70
|
-
* @param tokens - Token stream ending with `$eof`.
|
|
71
|
-
* @returns The start symbol parse tree, or null on syntax error.
|
|
72
|
-
*/
|
|
73
|
-
static parse(table, tokens) {
|
|
74
|
-
return ShiftReduceEngine.parseWithResult(table, tokens).cst;
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Parses a token stream and reports the first syntax error location.
|
|
78
|
-
*
|
|
79
|
-
* @param table - Parse table with ACTION, GOTO, and production metadata.
|
|
80
|
-
* @param tokens - Token stream ending with `$eof`.
|
|
81
|
-
* @returns Parse tree on success, or error offset and message on failure.
|
|
82
|
-
*/
|
|
83
|
-
static parseWithResult(table, tokens) {
|
|
84
|
-
if (!table.hasParserTable) {
|
|
85
|
-
return {
|
|
86
|
-
cst: null,
|
|
87
|
-
errorOffset: 0,
|
|
88
|
-
errorMessage: 'Parse table has no parser entries',
|
|
89
|
-
};
|
|
90
|
-
}
|
|
91
|
-
if (tokens.length === 0 || !(0, token_js_1.isEofToken)(tokens[tokens.length - 1])) {
|
|
92
|
-
return {
|
|
93
|
-
cst: null,
|
|
94
|
-
errorOffset: tokens[0]?.location.offset ?? 0,
|
|
95
|
-
errorMessage: 'Token stream must end with $eof',
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
const stateStack = [0];
|
|
99
|
-
const valueStack = [];
|
|
100
|
-
let tokenIndex = 0;
|
|
101
|
-
// Drive the parser until accept, error, or an unrecoverable reduce failure.
|
|
102
|
-
while (true) {
|
|
103
|
-
const state = stateStack[stateStack.length - 1];
|
|
104
|
-
const currentToken = tokens[tokenIndex];
|
|
105
|
-
const action = table.action(state, tokenActionKey(currentToken));
|
|
106
|
-
if (action === null) {
|
|
107
|
-
return {
|
|
108
|
-
cst: null,
|
|
109
|
-
errorOffset: currentToken.location.offset,
|
|
110
|
-
errorMessage: `Unexpected ${currentToken.name}`,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
switch (action.kind) {
|
|
114
|
-
case 'shift':
|
|
115
|
-
{
|
|
116
|
-
valueStack.push(astNodeFromToken(currentToken));
|
|
117
|
-
stateStack.push(action.state);
|
|
118
|
-
tokenIndex += 1;
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
case 'reduce':
|
|
122
|
-
{
|
|
123
|
-
const node = ShiftReduceEngine.reduce(table, action.productionId, stateStack, valueStack);
|
|
124
|
-
if (node === null) {
|
|
125
|
-
return {
|
|
126
|
-
cst: null,
|
|
127
|
-
errorOffset: currentToken.location.offset,
|
|
128
|
-
errorMessage: 'Invalid reduce action',
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
case 'accept':
|
|
134
|
-
{
|
|
135
|
-
if (valueStack.length === 0) {
|
|
136
|
-
return {
|
|
137
|
-
cst: null,
|
|
138
|
-
errorOffset: currentToken.location.offset,
|
|
139
|
-
errorMessage: 'Empty parse result',
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
cst: valueStack[valueStack.length - 1],
|
|
144
|
-
errorOffset: null,
|
|
145
|
-
errorMessage: null,
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Applies one reduce action and pushes the resulting subtree.
|
|
153
|
-
*
|
|
154
|
-
* @param table - Parse table with GOTO and production metadata.
|
|
155
|
-
* @param productionId - Production to reduce by.
|
|
156
|
-
* @param stateStack - Parser state stack.
|
|
157
|
-
* @param valueStack - Semantic value stack.
|
|
158
|
-
* @returns The reduced subtree pushed onto the value stack, or null on stack underflow.
|
|
159
|
-
*/
|
|
160
|
-
static reduce(table, productionId, stateStack, valueStack) {
|
|
161
|
-
const production = table.production(productionId);
|
|
162
|
-
if (production === null) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
const rhsLength = production.rhs.length;
|
|
166
|
-
const children = [];
|
|
167
|
-
// Pop one state and value per right-hand side symbol.
|
|
168
|
-
for (let index = 0; index < rhsLength; index += 1) {
|
|
169
|
-
if (stateStack.length === 0 || valueStack.length === 0) {
|
|
170
|
-
return null;
|
|
171
|
-
}
|
|
172
|
-
stateStack.pop();
|
|
173
|
-
const child = valueStack.pop();
|
|
174
|
-
if (child === undefined) {
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
children.unshift(child);
|
|
178
|
-
}
|
|
179
|
-
if (stateStack.length === 0) {
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
// Follow GOTO for the production left-hand side and push the new subtree.
|
|
183
|
-
const gotoState = table.goto(stateStack[stateStack.length - 1], production.name);
|
|
184
|
-
if (gotoState === null) {
|
|
185
|
-
return null;
|
|
186
|
-
}
|
|
187
|
-
const node = ShiftReduceEngine.nodeFromProduction(production, children);
|
|
188
|
-
valueStack.push(node);
|
|
189
|
-
stateStack.push(gotoState);
|
|
190
|
-
return node;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Builds a CST node for one reduced production.
|
|
194
|
-
*
|
|
195
|
-
* @param production - Reduced production metadata.
|
|
196
|
-
* @param children - Child subtrees matching the production right-hand side.
|
|
197
|
-
* @returns A rule CST node spanning the reduced children.
|
|
198
|
-
*/
|
|
199
|
-
static nodeFromProduction(production, children) {
|
|
200
|
-
return ast_node_js_1.AstNode.rule(production.name, children, mergeChildLocations(children), production.variant, production.id, production.origin);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
exports.ShiftReduceEngine = ShiftReduceEngine;
|
|
204
|
-
/**
|
|
205
|
-
* Parses a token stream using a serialized LR parse table.
|
|
206
|
-
*
|
|
207
|
-
* @param table - Parse table with ACTION, GOTO, and production metadata.
|
|
208
|
-
* @param tokens - Token stream ending with `$eof`.
|
|
209
|
-
* @returns The start symbol parse tree, or null on syntax error.
|
|
210
|
-
*/
|
|
211
|
-
function parseWithTable(table, tokens) {
|
|
212
|
-
return ShiftReduceEngine.parse(table, tokens);
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Parses a token stream and reports the first syntax error location.
|
|
216
|
-
*
|
|
217
|
-
* @param table - Parse table with ACTION, GOTO, and production metadata.
|
|
218
|
-
* @param tokens - Token stream ending with `$eof`.
|
|
219
|
-
* @returns Parse tree on success, or error offset and message on failure.
|
|
220
|
-
*/
|
|
221
|
-
function parseWithTableResult(table, tokens) {
|
|
222
|
-
return ShiftReduceEngine.parseWithResult(table, tokens);
|
|
223
|
-
}
|
|
224
|
-
//# sourceMappingURL=shift-reduce-engine.js.map
|
|
@@ -1 +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