From ffbe60094a0003e5a42f254ded7f4d053d566eef Mon Sep 17 00:00:00 2001 From: David Majda Date: Sun, 10 Apr 2011 20:22:10 +0200 Subject: [PATCH] Rewrite README.md --- CHANGELOG | 1 + README.md | 227 +++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 190 insertions(+), 38 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 04c0c21..86aa37e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -28,6 +28,7 @@ Small Changes: * Added PEG.js version information and homepage header to peg.js. * Generated code improvements and fixes. * Internal code improvements and fixes. +* Rewrote README.md. 0.5.1 (2010-11-28) ------------------ diff --git a/README.md b/README.md index 9383b78..7a4c17e 100644 --- a/README.md +++ b/README.md @@ -1,75 +1,226 @@ -PEG.js: Parser Generator for JavaScript -======================================= +PEG.js +====== - - -PEG.js is a parser generator for JavaScript based on the [parsing expression grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) formalism. It enables you to easily build fast parsers which process complex data or computer languages. You can use it as an underlying tool when writing various data processors, transformers, interpreters, or compilers. +PEG.js is a simple parser generator for JavaScript that produces fast parsers with excellent error reporting. You can use it to process complex data or computer languages and build transformers, interpreters, compilers and other tools easily. Features -------- - * Usable [from your browser](http://pegjs.majda.cz/online), from JavaScript code, or [from a command-line](http://pegjs.majda.cz/documentation#generating-a-parser) - * Simple and expressive [grammar syntax](http://pegjs.majda.cz/documentation#grammar) - * No separate lexical analysis step — both lexical and syntactical analysis are handled by one tool - * Handles wide class of grammars (superset of LL(*k*) and LR(*k*)) - * Precise and human-friendly error reporting + * Simple and expressive grammar syntax + * Integrates both lexical and syntactical analysis + * Parsers have excellent error reporting out of the box + * Based on [parsing expression grammar](http://en.wikipedia.org/wiki/Parsing_expression_grammar) formalism — more powerful than traditional LL(*k*) and LR(*k*) parsers + * Usable [from your browser](http://pegjs.majda.cz/online), from the command line, or via JavaScript API -Building --------- +Getting Started +--------------- + +[Online version](http://pegjs.majda.cz/online) is the easiest way to generate a parser. Just enter your grammar, try parsing few inputs, and download generated parser code. + +Installation +------------ + +### Command Line / Server-side + +To use command-line version, install [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/) first. You can then install PEG.js: + + $ npm install pegjs + +Once installed, you can use the `pegjs` command to generate your parser from a grammar and use the JavaScript API from Node.js. + +### Browser + +[Download](http://pegjs.majda.cz/#download) the PEG.js library (regular or minified version) and include it in your web page or application using the `