Fork preparation

redux
Sven Slootweg 4 years ago
parent 205c55d309
commit 69dbe3a4e4

@ -1,9 +1,6 @@
[![Build status](https://img.shields.io/travis/pegjs/pegjs.svg)](https://travis-ci.org/pegjs/pegjs)
[![npm version](https://img.shields.io/npm/v/pegjs.svg)](https://www.npmjs.com/package/pegjs)
[![Bower version](https://img.shields.io/bower/v/pegjs.svg)](https://github.com/pegjs/bower)
[![License](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT) [![License](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT)
PEG.js PEG-Redux
====== ======
PEG.js is a simple parser generator for JavaScript that produces fast parsers PEG.js is a simple parser generator for JavaScript that produces fast parsers
@ -11,6 +8,10 @@ with excellent error reporting. You can use it to process complex data or
computer languages and build transformers, interpreters, compilers and other computer languages and build transformers, interpreters, compilers and other
tools easily. tools easily.
PEG-Redux is a __work-in-progress__ fork of PEG.js, with the aim of continuing
maintenance on the PEG.js project, while adding support for modern features
such as modules.
Features Features
-------- --------
@ -20,49 +21,48 @@ Features
* Based on [parsing expression * Based on [parsing expression
grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) formalism grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) formalism
— more powerful than traditional LL(*k*) and LR(*k*) parsers — more powerful than traditional LL(*k*) and LR(*k*) parsers
* Usable [from your browser](https://pegjs.org/online), from the command line, * Usable from your browser, from the command line, or via JavaScript API
or via JavaScript API
Getting Started Differences from the original PEG.js
--------------- --------
[Online version](https://pegjs.org/online) is the easiest way to generate a * The plugin API has been dropped for now, as it was underspecified and not very commonly used. A new, more robust and extensive plugin API may come to exist in the future, if it turns out that there is a high demand for customizations that wouldn't fit into the PEG-Redux project itself.
parser. Just enter your grammar, try parsing few inputs, and download generated * Bower and stand-alone browser builds have been discontinued. Please use a bundler (see below) instead.
parser code. * AMD, UMD and globals support have been discontinued. The generated parsers now only support CommonJS.
* Module support. Both for importing other PEGRedux files, and for `require()`ing JS modules.
Installation Installation
------------ ------------
### Node.js ### Node.js
To use the `pegjs` command, install PEG.js globally: To use the `pegjs` command, install PEG-Redux globally:
```console ```console
$ npm install -g pegjs $ npm install -g peg-redux
``` ```
To use the JavaScript API, install PEG.js locally: To use the JavaScript API, install PEG-Redux locally:
```console ```console
$ npm install pegjs $ npm install peg-redux
``` ```
If you need both the `pegjs` command and the JavaScript API, install PEG.js both If you need both the `pegjs` command and the JavaScript API, install PEG-Redux
ways. both ways.
### Browser ### Browser
[Download](https://pegjs.org/#download) the PEG.js library (regular or minified PEG-Redux works with bundlers such as [Browserify](http://browserify.org/), [Parcel](https://parceljs.org/) and [Webpack](https://webpack.js.org/).
version) or install it using Bower:
```console Simply `require()` and use the module like you would in Node.js. The one exception is that modules (either PEG-Redux or Javascript modules) are not currently supported in browser environments.
$ bower install pegjs
``` Bower and standalone builds have been discontinued in this fork. Getting started with Browserify will only take a few minutes, and give you a better developer experience.
Generating a Parser Generating a Parser
------------------- -------------------
PEG.js generates parser from a grammar that describes expected input and can PEG-Redux generates parser from a grammar that describes expected input and can
specify what the parser returns (using semantic actions on matched parts of the specify what the parser returns (using semantic actions on matched parts of the
input). Generated parser itself is a JavaScript object with a simple API. input). Generated parser itself is a JavaScript object with a simple API.
@ -100,26 +100,20 @@ You can tweak the generated parser with several options:
`peg.generate` `peg.generate`
* `--extra-options-file` — file with additional options (in JSON format) to * `--extra-options-file` — file with additional options (in JSON format) to
pass to `peg.generate` pass to `peg.generate`
* `--format` — format of the generated parser: `amd`, `commonjs`, `globals`,
`umd` (default: `commonjs`)
* `--optimize` — selects between optimizing the generated parser for parsing * `--optimize` — selects between optimizing the generated parser for parsing
speed (`speed`) or code size (`size`) (default: `speed`) speed (`speed`) or code size (`size`) (default: `speed`)
* `--plugin` — makes PEG.js use a specified plugin (can be specified multiple * `--plugin` — makes PEG-Redux use a specified plugin (can be specified multiple
times) times)
* `--trace` — makes the parser trace its progress * `--trace` — makes the parser trace its progress
### JavaScript API ### JavaScript API
In Node.js, require the PEG.js parser generator module: Require the PEG-Redux parser generator module:
```javascript ```javascript
var peg = require("pegjs"); var peg = require("peg-redux");
``` ```
In browser, include the PEG.js library in your web page or application using the
`<script>` tag. If PEG.js detects an AMD loader, it will define itself as a
module, otherwise the API will be available in the `peg` global object.
To generate a parser, call the `peg.generate` method and pass your grammar as a To generate a parser, call the `peg.generate` method and pass your grammar as a
parameter: parameter:
@ -142,14 +136,7 @@ object to `peg.generate`. The following options are supported:
`false`) `false`)
* `dependencies` — parser dependencies, the value is an object which maps * `dependencies` — parser dependencies, the value is an object which maps
variables used to access the dependencies in the parser to module IDs used variables used to access the dependencies in the parser to module IDs used
to load them; valid only when `format` is set to `"amd"`, `"commonjs"`, or to load them.
`"umd"` (default: `{}`)
* `exportVar` — name of a global variable into which the parser object is
assigned to when no module loader is detected; valid only when `format` is
set to `"globals"` or `"umd"` (default: `null`)
* `format` — format of the genreated parser (`"amd"`, `"bare"`, `"commonjs"`,
`"globals"`, or `"umd"`); valid only when `output` is set to `"source"`
(default: `"bare"`)
* `optimize`— selects between optimizing the generated parser for parsing * `optimize`— selects between optimizing the generated parser for parsing
speed (`"speed"`) or code size (`"size"`) (default: `"speed"`) speed (`"speed"`) or code size (`"size"`) (default: `"speed"`)
* `output` — if set to `"parser"`, the method will return generated parser * `output` — if set to `"parser"`, the method will return generated parser
@ -503,25 +490,14 @@ environments:
* Safari * Safari
* Opera * Opera
However, please note that it is currently only actively tested in Node.js and Firefox. This will likely change in the future.
Development Development
----------- -----------
* [Project website](https://pegjs.org/) PEG-Redux is maintained by [Sven Slootweg (joepie91)](http://cryto.net/~joepie91).
* [Wiki](https://github.com/pegjs/pegjs/wiki) The original PEG.js was developed by [David Majda](http://majda.cz/) ([@dmajda](http://twitter.com/dmajda)).
* [Source code](https://github.com/pegjs/pegjs)
* [Issue tracker](https://github.com/pegjs/pegjs/issues)
* [Google Group](http://groups.google.com/group/pegjs)
* [Twitter](http://twitter.com/peg_js)
PEG.js is developed by [David Majda](https://majda.cz/)
([@dmajda](http://twitter.com/dmajda)). The [Bower
package](https://github.com/pegjs/bower) is maintained by [Michel
Krämer](http://www.michel-kraemer.com/)
([@michelkraemer](https://twitter.com/michelkraemer)).
You are welcome to contribute code. Unless your contribution is really trivial You are welcome to contribute code. Unless your contribution is really trivial
you should get in touch with me first — this can prevent wasted effort on both you should get in touch with me first — this can prevent wasted effort on both
sides. You can send code both as a patch or a GitHub pull request. sides. You can send code both as a patch or a pull request.
Note that PEG.js is still very much work in progress. There are no compatibility
guarantees until version 1.0.

@ -1,15 +1,16 @@
{ {
"name": "pegjs", "name": "peg-redux",
"version": "0.10.0", "version": "0.10.0",
"description": "Parser generator for JavaScript", "description": "Parser generator for JavaScript",
"keywords": [ "keywords": [
"parser generator", "parser generator",
"PEG" "PEG"
], ],
"homepage": "https://pegjs.org/",
"bugs": "https://github.com/pegjs/pegjs/issues",
"license": "MIT", "license": "MIT",
"author": "David Majda <david@majda.cz> (https://majda.cz/)", "contributors": [
"David Majda <david@majda.cz> (http://majda.cz/)",
"Sven Slootweg <admin@cryto.net>"
],
"files": [ "files": [
"CHANGELOG.md", "CHANGELOG.md",
"LICENSE", "LICENSE",

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save