|Description:||Parse text into an AST using a grammar definition|
ANTLR Runtime is an accessor using Active URI syntax with the following base identifiers:
and the following arguments: (for more details on argument passing details see here)
|Representation (org.netkernel.lang.antlr.AntlrGrammarRepresentation)||Antlr Grammar Definition|
|Representation (Determinate String)||text to parse|
|Representation (Determinate String)||The rule to use as the starting root of the grammar parser|
|Representation (Determinate String)||Comma separated string list of nodes to filter out|
The following verb is supported:
The following response representations can be returned for SOURCE requests:
This accessor throws no documented exceptions.
To use ANTLR Runtime accessor you must import the module urn:org:netkernel:lang:antlr:
The ANTLR runtime returns back a HDS representation of the abstract syntax tree of the input using the rule names at node names. Where anonymous literals are used in the grammar the node name of "LITERAL" is used. Any text capture is placed as the node values.
This accessor requires that the code generation target must be Java (which is the default) and that the definition is a combined lexer parser.
Embedded code stubs are ignored.
The operand is any text/string that conforms to the supplied operator grammar. A syntax error exception will be thrown if the input fails to match.
The startrule argument must specify the name of the rule in the operator grammar that will be used as the root to start parsing the input.
An optional comma separated string with the names of nodes to be omitted from the final HDS response. Allows grammar chaff to be cleaned such as removing insignificant newlines, whitespace and delimiters.
This runtime must be run on a Java JDK not a JRE since it requires the java compiler to internally compile the ANTLR generated classes.
This runtime generates a temporary directory to in which to place files such as the grammar and Java source files because ANTLR can only work this way. This directory will be deleted when the compiled grammar representation is garbage collected.
Using this operator grammar:
grammar Names; file : line+; line : NAME NEWLINE; NAME : ('a'..'z'|'A'..'Z')+ ; NEWLINE : '\r'? '\n' ;we can parse this operand input:
with the rule argument of "file" we obtain the representation...
if the filter argument is supplied and has a value of "NEWLINE" the following response is returned