diff --git a/README.md b/README.md index 360704f..2cb3157 100644 --- a/README.md +++ b/README.md @@ -37,11 +37,15 @@ Installation To use the `pegjs` command, install PEG.js globally: - $ npm install -g pegjs +```console +$ npm install -g pegjs +``` To use the JavaScript API, install PEG.js locally: - $ npm install pegjs +```console +$ npm install pegjs +``` If you need both the `pegjs` command and the JavaScript API, install PEG.js both ways. @@ -51,7 +55,9 @@ ways. [Download](http://pegjs.org/#download) the PEG.js library (regular or minified version) or install it using Bower: - $ bower install pegjs +```console +$ bower install pegjs +``` Generating a Parser ------------------- @@ -64,12 +70,16 @@ input). Generated parser itself is a JavaScript object with a simple API. To generate a parser from your grammar, use the `pegjs` command: - $ pegjs arithmetics.pegjs +```console +$ pegjs arithmetics.pegjs +``` This writes parser source code into a file with the same name as the grammar file but with “.js” extension. You can also specify the output file explicitly: - $ pegjs arithmetics.pegjs arithmetics-parser.js +```console +$ pegjs arithmetics.pegjs arithmetics-parser.js +``` If you omit both input and output file, standard input and output are used. @@ -96,7 +106,9 @@ You can tweak the generated parser with several options: In Node.js, require the PEG.js parser generator module: - var peg = require("pegjs"); +```javascript +var peg = require("pegjs"); +``` In browser, include the PEG.js library in your web page or application using the `