company logo

BNFParser - Parser for files or strings with defined BNF syntax

A string or file according to a given BNF syntax is based on a BNF definition, which is provided as string or file. The parser creates a BNFNode tree, which provides a node for each syntax element (symbol). After parsing the file properly, the parser returns the top BNFNode, which may be used for analyzing syntax elements. This is different from technique s b LEX/YACC ad other parser tools, that use call back functions or code executed immediately when recognizing a syntax element. Here, appropriate actions are performed by iterating through the BNFNode tree.

BNF parsers can be referenced as symbols in other BNF symbols. This allows defining common BNF symbols e.g. for name and number (as BNFStandardSymbols). You may create a hierarchy consisting of a BNF tree by passing the parent (the more complex definition) to the referenced BNF or by constructing objects for referenced BNF parsers.

Functions