parser-lr 0.2.2 → 0.2.4
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 +4 -4
- package/bin/parser-lr.js +1 -1
- package/package.json +10 -3
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# parser-lr
|
|
2
2
|
|
|
3
|
-
Shift-reduce parser for EBNF grammars.
|
|
3
|
+
Shift-reduce parser for EBNF grammars. Describe your language with a `.grammar` file, build an LR parse table, then lex and parse source into a concrete syntax tree or AST, for execution or code generation.
|
|
4
4
|
|
|
5
|
-
Grammar file syntax is documented in [
|
|
5
|
+
Grammar file syntax is documented in the [`.grammar` file syntax](https://github.com/adamrmoss/parser-lr/blob/main/docs/grammar.md) guide.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -98,8 +98,8 @@ const source = await readFile('program.txt', 'utf8');
|
|
|
98
98
|
const ast = context.parse(context.lex(source));
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
-
`ParseContext` exposes `lex`, `parse`, and `createLexer` for finer control. See [
|
|
101
|
+
`ParseContext` exposes `lex`, `parse`, and `createLexer` for finer control. See the [library API overview](https://github.com/adamrmoss/parser-lr/blob/main/src/lib/README.md).
|
|
102
102
|
|
|
103
103
|
## Example grammars
|
|
104
104
|
|
|
105
|
-
Sample `.grammar` files
|
|
105
|
+
Sample `.grammar` files are in the [grammars](https://github.com/adamrmoss/parser-lr/tree/main/grammars) directory (`calc.grammar`, `lisp.grammar`, `6502.grammar`, and the meta-grammar `grammar.grammar`). Use them as templates when writing your own language.
|
package/bin/parser-lr.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "parser-lr",
|
|
3
3
|
"author": "Adam R Moss <adamrmoss@gmail.com>",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"description": "Shift-reduce parser library for EBNF grammars",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/adamrmoss/parser-lr.git"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/adamrmoss/parser-lr#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/adamrmoss/parser-lr/issues"
|
|
14
|
+
},
|
|
7
15
|
"type": "module",
|
|
8
16
|
"sideEffects": false,
|
|
9
17
|
"engines": {
|
|
@@ -18,7 +26,7 @@
|
|
|
18
26
|
}
|
|
19
27
|
},
|
|
20
28
|
"bin": {
|
|
21
|
-
"parser-lr": "
|
|
29
|
+
"parser-lr": "bin/parser-lr.js"
|
|
22
30
|
},
|
|
23
31
|
"files": [
|
|
24
32
|
"bin",
|
|
@@ -30,7 +38,6 @@
|
|
|
30
38
|
"registry": "https://registry.npmjs.org/"
|
|
31
39
|
},
|
|
32
40
|
"scripts": {
|
|
33
|
-
"publish": "npm run build && npm publish",
|
|
34
41
|
"bootstrap": "npm link && parser-lr table generate -g grammars/grammar.grammar -o src/lib/grammar/grammar.json",
|
|
35
42
|
"build": "npm run build:clean && npm run build:lib && npm run build:cli",
|
|
36
43
|
"build:clean": "rm -rf dist && rm -f bin/parser-lr.js bin/parser-lr.js.map",
|