occam-grammars 1.0.485 → 1.0.486
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 +19 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
- [Introduction](#introduction)
|
|
8
8
|
- [Installation](#installation)
|
|
9
|
-
- [Usage](#usage)
|
|
10
9
|
- [Examples](#examples)
|
|
10
|
+
- [Usage](#usage)
|
|
11
11
|
- [Building](#building)
|
|
12
12
|
- [Contact](#contact)
|
|
13
13
|
|
|
@@ -39,6 +39,24 @@ You can also clone the repository with [Git](https://git-scm.com/)...
|
|
|
39
39
|
|
|
40
40
|
You can also run a development server, see the section on building later on.
|
|
41
41
|
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
There is a small development server that can be run from within the project's directory with the following command:
|
|
45
|
+
|
|
46
|
+
npm start
|
|
47
|
+
|
|
48
|
+
The examples will then be available at the following URL:
|
|
49
|
+
|
|
50
|
+
http://localhost:8888
|
|
51
|
+
|
|
52
|
+
The source for the examples can be found in the `src/example.js` file and corresponding `src/example` folder. You are encouraged to try the examples whilst reading what follows. You can rebuild them on the fly with the following command:
|
|
53
|
+
|
|
54
|
+
npm run watch-debug
|
|
55
|
+
|
|
56
|
+
The development server will reload the page whenever you make changes.
|
|
57
|
+
|
|
58
|
+
One last thing to bear in mind is that this package is included by way of a relative rather than a package import. If you are importing it into your own application, however, you should use the standard package import.
|
|
59
|
+
|
|
42
60
|
## Usage
|
|
43
61
|
|
|
44
62
|
Import the requisite lexer and parser from this package. Then call their fromNothing(...) factory methods.
|
|
@@ -63,10 +81,6 @@ const content = `
|
|
|
63
81
|
|
|
64
82
|
The tokens returned from the lexers's `tokenise(...)`` method can be passed directly to the parser's `parse(...) method`, which itself returns a node or `null`.
|
|
65
83
|
|
|
66
|
-
## Examples
|
|
67
|
-
|
|
68
|
-
There are examples for each grammar. To view them, open the `index.html` file in the root of the repository. Each example shows a representation of the parse tree, which is useful for debugging.
|
|
69
|
-
|
|
70
84
|
## Building
|
|
71
85
|
|
|
72
86
|
Automation is done with [npm scripts](https://docs.npmjs.com/misc/scripts), have a look at the `package.json` file. The pertinent commands are:
|
|
@@ -74,12 +88,6 @@ Automation is done with [npm scripts](https://docs.npmjs.com/misc/scripts), have
|
|
|
74
88
|
npm run build-debug
|
|
75
89
|
npm run watch-debug
|
|
76
90
|
|
|
77
|
-
You can also start a small development server:
|
|
78
|
-
|
|
79
|
-
npm start
|
|
80
|
-
|
|
81
|
-
The example will then be available at http://localhost:8888 and will reload automatically when changes are made.
|
|
82
|
-
|
|
83
91
|
## Contact
|
|
84
92
|
|
|
85
93
|
* james.smith@djalbat.com
|