Grammars + Parsers + APIs

Grammars model parsers. Parsers execute grammars. APIs run parsers.


NETS is an experimental project that provides a common way to configure, run and integrate parsers, locally and in the cloud. It includes concepts from Extended Backus Naur Form (EBNF), ISO/IEC 14977, Parser Expression Grammars (PEGs), Abstract Syntax Trees (ASTs) represented as DOMs, pipelines and grammar libraries. It is an open source project for anyone to use and contribute to.

Download Documentation

Grammars

Grammars define the rules for configuring and running a parser.

Parsers

Parsers use grammars to configure how they consume input and produce output.

APIs

The Command line, JavaScript, C and REST APIs integrate parsers into systems.

Common Model for Language Grammars

There are many grammar languages in use today including regular expressions, BNF, EBNF and PEGs. Understanding the common characteristics of grammar languages is the subject of 'A Common Model for Language Grammars', (Nelms, 2013).

A Common Model for Language Grammars

JavaScript API

In addition to a Command Line Interface and RESTful Interface, NETS include a JavaScript API that allows complex grammars to be executed in either Node or web browsers.

JavaScript API

Parser Expression Grammars

Parser Expression Grammars or PEGs (Ford, 2004) introduced predicates. PEGs formalise 'and' and 'not' predicates previously explored in ISO 14977 exceptions. In addition nets introduces the 'again' predicate for repeated parsing of the same input.

Predicates

Declarative Abstract Syntax Trees based on W3C DOM

NETS supports a declarative model of Abstract Syntax Trees (ASTs) based on the W3C DOM model. This model is unified with the input/output model. NETS supports document, element, attribute, entity, entity reference, text, processinginstruction and comment nodes.

Streamed Document Object Model

ISO/IEC 14977 and EBNF Grammars

ISO/IEC 14977 is the international standard for grammars. NETS supports ISO/IEC 14977 grammars including rules, terminals, non-terminals, group sequences, optional sequences, repeating sequences, exceptions, factors, the empty sequence and comments. Special sequences are supported as production terminals.

EBNF and ISO 14877 Grammars

Grammar XML

GXML is an XML representation of grammars capable of modeling BNF, EBNF, PEG and NEBNF grammars. NETS implements GXML as well as ISO 14877.

XML Grammars

Pipelines

NETS EBNF introduces pipelines, which allow grammars to be chained together in sequences with the output of one primary becoming the input to another. Pipelines simplify parsers and grammars.

Pipelines

Grammar Libraries

NETS supports user defined and system defined grammar libraries in compiled and interpretted forms.

Libraries