{"name":"apg-lite","version":"1.0.0","keywords":["APG","parser","ABNF","SABNF"],"author":{"url":"https://sabnf.com/","name":"Lowell D. Thomas","email":"ldt@sabnf.com"},"license":"BSD-2-Clause","_id":"apg-lite@1.0.0","homepage":"https://github.com/ldthomas/apg-lite#readme","bugs":{"url":"https://github.com/ldthomas/apg-lite/issues"},"dist":{"shasum":"f9b7ca7318ae4e1b8f05280c1011de854fa4f3ad","tarball":"http://registry-npm.ywwl.com/apg-lite/download/apg-lite-1.0.0.tgz","fileCount":4,"integrity":"sha512-TLX4C6h3Kr7fqP2cG9/r3uEIFJb/NuQCuq8bfI4qPN93zruGOmZpotGwTm1rO+Dd3vgHOijkEeUh63P8pP2YAQ==","signatures":[{"sig":"MEUCIAfO7k/jloKdpCgIUP79fWioj5tCmgchadqW/E1zsOEHAiEAkumCR1cs5alorPHyk4cjfir2XBHQ7NVDxzCUbNATRqg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":43986,"size":11544,"noattachment":false,"key":"/apg-lite/-/apg-lite-1.0.0.tgz"},"jest":{"bail":1,"verbose":true,"testRegex":"/__tests__/.*\\.test\\.js"},"main":"lib/parser.js","type":"module","gitHead":"88228f64e290d7fa15fcd39dd817d2dbdecf228d","scripts":{"apg":"node_modules/apg-js/bin/apg.sh","ast":"node ast-app/parser-app.js && node ast-app/ast-app.js","udt":"node udt-app/node-app.js","uri":"node uri-app/node-app.js","cool":"node cool-app/node-app.js","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js","basic":"node basic-app/node-app.js","trace":"node trace-app/node-app.js","terser":"terser","lookahead":"node lookahead-app/positive-app.js && node lookahead-app/negative-app.js"},"_npmUser":{"name":"ldthomas","email":"ldt@sabnf.com"},"repository":{"url":"git+https://github.com/ldthomas/apg-lite.git","type":"git"},"_npmVersion":"10.1.0","description":"lightweight JavaScript APG parser","directories":{},"_nodeVersion":"20.9.0","_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","apg-js":"^4.3.0","eslint":"^7.26.0","terser":"^5.24.0","prettier":"^2.3.0","eslint-config-airbnb":"^18.2.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0"},"_npmOperationalInternal":{"tmp":"tmp/apg-lite_1.0.0_1701113832479_0.5435516447271651","host":"s3://npm-registry-packages"},"readme":"# APG Lite\n\n`apg-lite` is a light-weight parser of [ABNF](https://www.rfc-editor.org/rfc/rfc5234) grammars.\nIt is a parser only.\nIt relies on [apg-js](https://github.com/ldthomas/apg-js), version 4.3.0 or higher, with the new `--lite` option\nto generate ESM grammar objects.\n`apg-lite` features:\n\n- Parses only JavaScript strings, whereas `apg-js` can parse any arbitrary array of positive integers.\n- Retains only three of the eight [SABNF](https://sabnf.com/docs/python/md_docs_SABNF.html) superset operators of `apg-js`.\n  - UDT, (User-Defined Terminals) Handwritten, phrase-matching code snippets.\n  - AND, The positive look-ahead operator (see [syntactic predicates](https://en.wikipedia.org/wiki/Syntactic_predicate)).\n  - NOT, The negative look-ahead operator.\n- The AST has been simplified (see `./ast-app/`).\n- Tracing (debugging) the parse tree has been simplified (see `./trace-app/`).\n- Statistics collection (profiling) has been simplified (see `./trace-app/`).\n- `apg-lite` is fully contained in a single JavaScript file.\n  - `./lib/parser.js` contains ECMAScript Modules (ESM) which can be `import`-ed into your application.\n  - `./lib/web-parser.js` can be scripted into your web page application with no bundling necessary.\n\nA number of example application are included here to demonstrate the use of `apg-lite` in both\nNode.js and web page applications. Each example application is in its own directory.\nThe documentation for each is in the file `documentation.md`.\nMost (but not all) examples will be presented as both Node.js and web page applications.\n\n- `./basic-app/` - A simple parser demonstrating the most basic construction and use of a parser.\n- `./ast-app/` - Use of the AST - how to construct the AST and translate or semantically manipulate the phrases captured by the AST nodes.\n  Demonstrates generating an XML version of the AST.\n- `./udt-app/` - Use of a UDT, a handwritten code snippet to recognize a somewhat complicated phrase.\n- `./lookahead-app/` - Demonstration of the look ahead operators.\n- `./trace-app/` - How to debug and profile the parse tree.\n  - Tracing is the primary means of debugging a grammar or input string.\n  - Counting node hits serves as a type of profiling, exposing which rules are most often hit.\n- `./cool-app/` - A simple demonstration of parsing a string with UTF+32 (in this case emoticon) characters.\n- `./uri-app/` - This example builds a light-weight, but robust and well-tested URI parser.\n\nThe Node.js applications can all be run from the `package.json` scripts.\nUse `npm run` to see the script names of the demonstrations.\n\n### The URI Parser\n\nThe `UriParser` object in the `./uri-app/` application is of special interest.\nIt is a fully-contained (no dependencies) [URI](https://www.rfc-editor.org/rfc/rfc3986) parser.\nIt is well-tested in the [Jest](https://jestjs.io/) unit tests in the `__tests__` directory.\n\nSee `./uri-app/documentation.md` for complete documentation.\nSee `./uri-app/node-app.js` for a sample Node.js application\nand `./uri-app/web.html` for sample web page application.\n","publish_time":1701113832748,"maintainers":[{"name":"ldthomas","email":"ldt@sabnf.com"}],"_cnpm_publish_time":1701113832748,"dist-tags":{"latest":"1.0.7"}}