aParse - Augmented BNF

Augmented Backus-Naur Form (ABNF) is defined by RFC 5234. aParse reads grammar files that comply with RFC 5234 but with the following deviations.

2.1. Rule Naming

The name of a rule is ... a sequence of characters, beginning with an alphabetic character, and followed by a combination of alphabetics, digits, hyphens (dashes) and underscores.

The name of a rule may include the underscore _ character.

2.2. Rule Form

A rule is defined by the following sequence:

name = elements ;

The semi-colon ; is used to signal the end of a rule.

3.9. Comments

A hash starts a comment that continues to the end of line.

rule = elements # comment

The hash # rather than a semi-colon ; is used to start a comment.

4. ABNF Definition of ABNF

rulename = ALPHA *(ALPHA / DIGIT / "-" / "_") ;

rulename can include the underscore _ character.

element = rulename / group / option / char-val / num-val ;

prose-val is not supported.

B.1. Core Rules

No core rules are defined. All rules must be defined explicitly.

aParse Extensions

$include Directive

One grammar file can be read into another using the $include directive.

$include "core.abnf";

Relative and absolute paths may be used. When no path is declared, the directories searched for include files can be specified via the optional -includeDirs argument.

$rule Directive

The use of the $rule directive within an ABNF grammar instructs aParse to use external user code to parse specific protocol elements. See External Rules (Java) and External Rules (C++).