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 DocumentationCommon 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 GrammarsJavaScript 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 APIParser 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.
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.
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.
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
.
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.
PipelinesGrammar Libraries
NETS supports user defined and system defined grammar libraries in compiled and interpretted forms.
Libraries