Getting Started

Install, configure and run Nets parser.


Download and Installation

To download the latest release select the download by platform (win,mac,linux,wasm), the architecture (x64,x32), the date and build number.

Windows x32, Windows x64, Mac x64, Linux x64 and Web Assembly

To install, unzip the package in your required folder.

Running Nets Parser

Nets parser is started from the command line by invoking the 'nets-parser' executable.

>nets-parser
NETS3 Command Line Interface v1.0.
(C) Copyright 2016 NETS3 Ltd

To see more detailed logging information set -loglevel=3

>nets-parser -loglevel=3
NETS3 Command Line Interface v1.0.
(C) Copyright 2016 NETS3 Ltd
16/10/15 18:12:45 INF 6908:3 Working directory c:\netscli
16/10/15 18:12:45 INF 6908:3 Opening grammar library nets-parser-iconv
16/10/15 18:12:45 INF 6908:3 Opening grammar library nets-parser-library
16/10/15 18:12:45 ERR 6908:3 Opening default.g file
16/10/15 18:12:45 ERR 6908:3 Cannot start parser. Parser needs to be initialised.

Hello World

The parser needs an to be configured with a grammar, an input and an output.

>nets-parser -loglevel=3 -grammar="mem:start={char.};" -input="mem:Hello World" -output=stdout -grammar_encoding="WCHAR_T" -encoding="WCHAR_T/ASCII"
NETS3 Command Line Interface v1.0.
(C) Copyright 2016 NETS3 Ltd
16/10/15 18:45:58 INF 8040:3 Working directory c:\netscli
16/10/15 18:45:58 INF 8040:3 Opening grammar library nets-parser-iconv
16/10/15 18:45:58 INF 8040:3 Opening grammar library nets-parser-library
16/10/15 18:45:58 INF 8040:3 Parser started
16/10/15 18:45:58 INF 8040:3 Parser ended
Hello World16/10/15 18:45:58 INF 8040:3 Closing error file

Notice that in addition to the -input, -output and -grammar parameters the -grammar_encoding and -encoding parameters are required to read the grammar and input from memory.

A Simple Grammar

Now create two files default.g and default.in with the following code snippets.

start={char.};

The grammar is constructed using a rule ('start'), an iteration (using '{}'), a rule reference ('char'), the echo paramater ('.') and the end of rule symbol (';'). This grammar repeatedely reads a character from the input and echos it to the output until no more characters can be found.

Hello World

Run nets-parser with default.g as the grammar, default.in as the input and default.out as the output.

>nets-parser -loglevel=3 -grammar=default.g -input=default.in -output=default.out
NETS3 Command Line Interface v1.0.
(C) Copyright 2016 NETS3 Ltd
16/10/15 19:02:13 INF 6820:3 Working directory c:\netscli
16/10/15 19:02:13 INF 6820:3 Opening grammar library nets-parser-iconv
16/10/15 19:02:13 INF 6820:3 Opening grammar library nets-parser-library
16/10/15 19:02:13 INF 6820:3 Opening default.g file
16/10/15 19:02:13 INF 6820:32 Parse finished before end of input by 2 bytes
16/10/15 19:02:13 INF 6820:3 Closing file default.g
16/10/15 19:02:13 INF 6820:3 Parser started
16/10/15 19:02:13 INF 6820:3 Opening default.in file
16/10/15 19:02:13 INF 6820:3 Opening default.out file
16/10/15 19:02:13 INF 6820:3 Parser ended
16/10/15 19:02:13 INF 6820:3 Closing file default.in
16/10/15 19:02:13 INF 6820:3 Closing file default.out
16/10/15 19:02:13 INF 6820:3 Closing error file

The result will be the following.

Hello World