These directives apply to the entire specification, and should only be specified once unless noted.
Semi-optional (defaults to Java with a warning). Specifies the target language. Targets supported or under development:
Optional, no default. Specifies the package for Java target.
package jburg.tutorial.first;
Optional, no default. Specifies a base class for the generated BURM.
extends BaseBURM;
Deprecated. Optional, no default. Specifies an interface which the generated BURM implements.
Optional, no default. Specifies import
statements and other material copied verbatim into the generated BURM's class header section.
Required. Specifies the type of AST node.
INodeType CommonTree; // Use ANTLR AST nodes as the i-node type
Optional, but de facto required. Specifies the i-node adapter type.
INodeAdapter jburg.burg.inode.Antlr3JavaAdapter;
Builtin adapters:
Building a custom INodeAdapter
Optional, may be specified more than once. Specifies the type of AST node that backs a particular opcode. This AST type must be a subclass of the overall INodeType.
JBurg.NodeType INT = burmTest.LiteralIntNode;
Optional, defaults to int or platform-specific analog. Specifies the name of an enumeration that encodes the type field of the i-nodes.
OpcodeType ASTNodeID;
Optional, no default. Specifies the name of an enumeration that encodes the nonterminal names used in the specification.
JBurg.NonterminalType burmTest.NonterminalTypes;
If this directive is not specified, then JBurg will generate int constants for each nonterminal it encounters, e.g., statement
becomes __statement_NT
. Specifying the nonterminal types as an enumeration is beneficial for documentation and also catches typos in the specification.
Optional. Specifies error handling code that is compiled into the BURM and is invoked if the BURM cannot find a valid sequence of reductions to cover the input tree. See the debugging section for details.
Optional, no default. Specifies the names of cost functions that need to be re-evaluated, not cached. This directive should be used with great restraint, since it can create very slow pattern matchers.
JBurg.VolatileCostFunctions volitileCost1, volitileCost2;
Optional, recommended. Specifies a named integer constant; these manifest constants are typically used instead of int literals as cost specifications. Using JBurg.Constant entries instead of references to host language manifest constants may allow JBurg to do more cost analysis at compiler-compile time and result in much faster pattern matchers.
JBurg.Constant ERROR_TRAP = 268435456;
Wiki: Debugging
Wiki: FirstCodeGenerator
Wiki: INodeAdapter
Wiki: JBurg Reference
Wiki: JBurg2 Syntax