All Projects → SimplePEG → JavaScript

SimplePEG / JavaScript

Licence: MIT License
JavaScript version ( Browser and Node.js ) of SimplePEG

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to JavaScript

Ohm
A library and language for building parsers, interpreters, compilers, etc.
Stars: ✭ 3,938 (+28028.57%)
Mutual labels:  peg
arborist
Arborist is a PEG parser that supports left-associative left recursion
Stars: ✭ 17 (+21.43%)
Mutual labels:  peg
ohm-editor
An IDE for the Ohm language (JavaScript edition)
Stars: ✭ 78 (+457.14%)
Mutual labels:  peg
kiuatan
A parser library for Pony.
Stars: ✭ 15 (+7.14%)
Mutual labels:  peg
pegnet
pegnet.org
Stars: ✭ 41 (+192.86%)
Mutual labels:  peg
pe
Fastest general-purpose parsing library for Python with a familiar API
Stars: ✭ 21 (+50%)
Mutual labels:  peg
Pest
The Elegant Parser
Stars: ✭ 2,783 (+19778.57%)
Mutual labels:  peg
latex2unicode
Convert LaTeX markup to Unicode (in Scala and Java)
Stars: ✭ 28 (+100%)
Mutual labels:  peg
ParsecSharp
The faster monadic parser combinator library for C#
Stars: ✭ 23 (+64.29%)
Mutual labels:  peg
lucene
Node.js lib to transform: lucene query → syntax tree → lucene query
Stars: ✭ 61 (+335.71%)
Mutual labels:  peg
peggy
Peggy: Parser generator for JavaScript
Stars: ✭ 444 (+3071.43%)
Mutual labels:  peg
pyrser
A PEG Parsing Tool
Stars: ✭ 32 (+128.57%)
Mutual labels:  peg
cppcombinator
parser combinator and AST generator in c++17
Stars: ✭ 20 (+42.86%)
Mutual labels:  peg
raabro
a Ruby PEG parser library
Stars: ✭ 31 (+121.43%)
Mutual labels:  peg
pegjs-util
Utility Class for PEG.js
Stars: ✭ 29 (+107.14%)
Mutual labels:  peg
Guido blog translation
翻译 Guido 的解析器系列文章
Stars: ✭ 200 (+1328.57%)
Mutual labels:  peg
mastermind
The Mastermind game made in Webpack, ES6 and React
Stars: ✭ 25 (+78.57%)
Mutual labels:  peg
chumsky
A parser library for humans with powerful error recovery.
Stars: ✭ 740 (+5185.71%)
Mutual labels:  peg
lpegrex
Parse programming languages syntax into an AST using PEGs with ease (LPeg Extension).
Stars: ✭ 32 (+128.57%)
Mutual labels:  peg
peg
Import of Ian Piumarta's peg/leg recursive-descent parser generators for C
Stars: ✭ 41 (+192.86%)
Mutual labels:  peg

JavaScript

Join the chat at https://gitter.im/SimplePEG/JavaScript Greenkeeper badge Build Status Coverage Status

JavaScript version ( Browser and Node.js ) of SimplePEG. A very simple implementation of PEG parser generator.

const simplepeg = require('simplepeg');
const parser = new simplepeg.SPEG();

parser.parse_grammar('GRAMMAR test a->"A";');
const ast = parser.parse_text('A');
console.log(JSON.stringify(ast, null, 4));

Grammar example

url.peg

GRAMMAR url

url       ->  scheme "://" host pathname search hash?;
scheme    ->  "http" "s"?;
host      ->  hostname port?;
hostname  ->  segment ("." segment)*;
segment   ->  [a-z0-9-]+;
port      ->  ":" [0-9]+;
pathname  ->  "/" [^ ?]*;
search    ->  ("?" [^ #]*)?;
hash      ->  "#" [^ ]*;
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].