|
1 | 1 | # Fluent Specification Support Code |
2 | 2 |
|
3 | | -This directory contains support code for the parser-combinator underlying the syntax code, as well as the code to transform `grammar.mjs` to `fluent.ebnf`. The combination allows for a succinct formulation of the syntax in `grammar.mjs` and a readable representation of that in `fluent.ebnf`. |
| 3 | +This directory contains support code for the parser-combinator underlying the syntax code, as well as the code to transform `grammar.js` to `fluent.ebnf`. The combination allows for a succinct formulation of the syntax in `grammar.js` and a readable representation of that in `fluent.ebnf`. |
4 | 4 |
|
5 | 5 | ## Parser-Combinator |
6 | 6 |
|
7 | | -**`parser.mjs`** is the base parser class, **`stream.mjs`** holds a iterator over the strings to be parsed. |
| 7 | +**`parser.js`** is the base parser class, **`stream.js`** holds a iterator over the strings to be parsed. |
8 | 8 |
|
9 | | -**`combinators.mjs`** holds the actual basic grammar productions and logical combinations of grammar productions. |
| 9 | +**`combinators.js`** holds the actual basic grammar productions and logical combinations of grammar productions. |
10 | 10 |
|
11 | | -Both use `Success` and `Failure` from **`result.mjs`** to pass success and failure conditions forward. |
| 11 | +Both use `Success` and `Failure` from **`result.js`** to pass success and failure conditions forward. |
12 | 12 |
|
13 | | -After the definition of grammar productions, the utilities in **`mappers.mjs`** are used to concat, flatten, and extract the matched data to prepare it for AST generation. |
| 13 | +After the definition of grammar productions, the utilities in **`mappers.js`** are used to concat, flatten, and extract the matched data to prepare it for AST generation. |
14 | 14 |
|
15 | 15 | ## EBNF Generation |
16 | 16 |
|
17 | | -The `fluent.ebnf` is created by parsing the `grammar.mjs` and transpilation to an EBNF file. The `babylon` JavaScript parser is used to load a Babel AST. |
| 17 | +The `fluent.ebnf` is created by parsing the `grammar.js` and transpilation to an EBNF file. The `babylon` JavaScript parser is used to load a Babel AST. |
18 | 18 |
|
19 | | -**`ebnf.mjs`** is the top-level entry point used by `bin/ebnf.mjs`. It uses the iteration logic from **`walker.mjs`** to go over the Babel AST and to extract the information relevant to the EBNF via the Visitor in **`visitor.mjs`**. The resulting data is then serialiazed to EBNF via **`serializer.mjs`**. |
| 19 | +**`ebnf.js`** is the top-level entry point used by `bin/ebnf.js`. It uses the iteration logic from **`walker.js`** to go over the Babel AST and to extract the information relevant to the EBNF via the Visitor in **`visitor.js`**. The resulting data is then serialiazed to EBNF via **`serializer.js`**. |
0 commit comments