WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

This modules provides an ANTLR Parser runtime and grammar compiling transreptor. ANTLR, in it's own words, is "a sophisticated parser generator you can use to implement language interpreters, compilers, and other translators". ANTLR can do a lot of things but many of those things require binding code into it either by interfacing to it's generated code or by embedding code into it's grammar definitions. In fact ANTLR generates code for a parser that must first be compiled. ANTLR is great for declaratively defining grammars but you still need to write a lot of specific glue code to interface it into a system.

NetKernel takes a simple approach. It defines an accessor that can transform input text into a hierarchical abstract syntax tree (AST) representation based upon a specified grammar definition resource. Grammar resources can be dynamic and NetKernel will cache a pre-compiled parser. This presents ANTLRs core functionality and power in a clean and easy to use form.

As an example imagine taking english prose and breaking it up into chapters, paragraphs, sentences, verbs, nouns, punctuation etc. Having the information in this rich structure allows for powerful processing of text in ways that previously could only be done with XML.

Grammars are defined by Antlr's variant of Extended Backus Naur Form (EBNF).

Getting Started

Antlr is powerful but much of the complexity is in the code generation aspect. The active:antlr runtime aims to simplify Antlr to focus purely on lexer parser grammars generating abstract parse trees.

If you're not familiar with the basics of Antlr grammars review this article.