|
| 1 | +# JavaScript APG |
| 2 | + |
| 3 | +## What's New |
| 4 | + |
| 5 | +`apg-js` obsoletes `apg`, `apg-lib`, `apg-exp`, `apg-conv`, `apg-conv-api` and `apg-api`. It changes them in two significant ways. |
| 6 | + |
| 7 | +- It fixes a major problem in the attributes algorithm. Previous versions could fail on large grammars with many or large sets of mutually-recursive rules. |
| 8 | +- It combines all of those packages into a single, easier to manage and maintain package. |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +`apg-js` is the JavaScript version of APG, an ABNF Parser Generator. APG generates recursive-descent parsers directly from a superset of [ABNF](https://tools.ietf.org/html/rfc5234) (SABNF). Visit the [APG](https://sabnf.com/`) website for a complete [overview](https://sabnf.com/overview/) of APG and SABNF. |
| 13 | + |
| 14 | +## Installation |
| 15 | + |
| 16 | +> `npm install apg-js` |
| 17 | +
|
| 18 | +or |
| 19 | + |
| 20 | +> `git clone https://github.com/ldthomas/apg-js.git` |
| 21 | +
|
| 22 | +## Documentation |
| 23 | + |
| 24 | +This package is meant to assist other parsing applications and is normally not installed by itself, rather installed along with those other applications. For details and many examples of using of the libraries, both in node.js and browser applications, see `apg-js-examples` at [GitHub](https://github.com/ldthomas/apg-js-examples) or [npmjs](https://www.npmjs.com/package/apg-js-examples). |
| 25 | +However, it does provide access to two, node.js applications. |
| 26 | + |
| 27 | +### Applications |
| 28 | + |
| 29 | +`apg` is the parser generator. To see its usage run, |
| 30 | + |
| 31 | +> `npm run apg` |
| 32 | +
|
| 33 | +`apg-conv` is a data conversion application. To see its usage run, |
| 34 | + |
| 35 | +> `npm run apg-conv` |
| 36 | +
|
| 37 | +### Libraries |
| 38 | + |
| 39 | +This package also contains four libraries that can be used in either node.js or browser applications. |
| 40 | +The libraries depend upon one another and the dependency tree looks like so: |
| 41 | + |
| 42 | +``` |
| 43 | +apg-exp |
| 44 | +|- apg-api |
| 45 | +|-|- apg-lib |
| 46 | +|-|-|- apg-conv-api |
| 47 | +``` |
| 48 | + |
| 49 | +Each of the libraries is bundled for browser use along with some special styles. |
| 50 | +Each bundle contains all of its dependencies explicitly. That is, if a browser application needs both `apg-api` and `apg-lib`, only the `apg-api` bundle need be scripted into the page. |
| 51 | + |
| 52 | +The library and css bundles are in the `./dist` directory. |
| 53 | + |
| 54 | +``` |
| 55 | +./dist/apg-exp-bundle.js |
| 56 | +./dist/apg-api-bundle.js |
| 57 | +./dist/apg-lib-bundle.js |
| 58 | +./dist/apg-conv-api-bundle.js |
| 59 | +./dist/apg-lib-bundle.css |
| 60 | +``` |
| 61 | + |
| 62 | +The bundles can all be regenerated with: |
| 63 | + |
| 64 | +``` |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +npm run bundle-apg-conv-api |
| 69 | +npm run bundle-apg-lib |
| 70 | +npm run bundle-apg-api |
| 71 | +npm run bundle-apg-exp |
| 72 | +npm run bundle-apg-lib-css |
| 73 | +``` |
| 74 | + |
| 75 | +### Code Documentation |
| 76 | + |
| 77 | +The code documentation is in [docco](http://ashkenas.com/docco/) format and can be generated with: |
| 78 | + |
| 79 | +``` |
| 80 | + |
| 81 | +./bin/docco-gen.sh |
| 82 | +``` |
| 83 | + |
| 84 | +(Higher versions of docco may work, but some lower versions definitely do not.) |
| 85 | +The documentation is then at `./docs/index.html` or see it [here](https://sabnf.com/docs/java-script/apg-exp-guide/index.html) at the [APG](https://sabnf.com/) website. |
0 commit comments