java -jar jburg.jar [options] specificationFile
Commonly used options
-g : generate debugging code-outputdir : emit the BURM in the specified directory-inputdir : read the specification from the specified directory-outputfile : emit the BURM into the specified fileJBurg integrates well into ant builds via a jburg macrodef.
Language Java;
package jburg.tutorial.first;
extends BaseBURM; // Optional
implements FrontEndTokenTypes; // Deprecated.
// Optional, no default.
header {
import java.util.*;
}
INodeType CommonTree; // Use ANTLR AST nodes as the i-node type
JBurg.NodeType INT = burmTest.LiteralIntNode;
INodeAdapter jburg.burg.inode.Antlr3JavaAdapter;
OpcodeType ASTNodeID;
JBurg.NonterminalType burmTest.NonterminalTypes;
DefaultErrorHandler {
// p refers to the annotation object at
// the root of the unreducible subtree.
new UnknownTreeHandler().analyze(p);
}
See the debugging section for details.
JBurg.VolatileCostFunctions volatileCost1, volatileCost2;
JBurg.Constant ERROR_TRAP = 268435456;
{
// Target and implementation specific code
}
JBurg.include DirectiveJBurg.include "../arithmetic/IntegerArithmetic.jbg"
JBurg.include "IntegerArithmetic.jbg" SUBSTITUTE_ADD="ADD" SUBSTITUTE_INT="INT(void)" { "#int#"="intValue()" }
nonterminal = NODE_TYPE(subtreeNonterminal subtreeName, subtreeNonterminalPrime subtreeNamePrime): cost
nonterminal = NODE_TYPE(void): cost
nonterminal = NODE_TYPE(subtreeNonterminal subtreeName*): cost
{reduction action}
or
nonterminal = NODE_TYPE(subtreeNonterminal subtreeName+): cost
{reduction action}
or
nonterminal = NODE_TYPE(subtreeNonterminal subtreeName subtreeVariadicNonterminal subtreeName*): cost
{reduction action}
nonterminalPrime = originalNonterminal;
nonterminalPrime = originalNonterminal: cost
{reduction action};
nonterminalName = NODE_TYPE(subtreeType subtree): cost
{
return actionForNodeType(#nonterminalName, subtree);
}
intExpression = ADD(intExpression lhs, intExpression rhs): cost
JBurg.Reduction reducer.emitIntegerAdd(lhs, rhs);
objExpression = FUNCTION(functionHeader header, functionBody body): cost
Prologue reducer.setUpFunctionExpression(p)
JBurg.Reduction reducer.emitFunctionExpression(__p, header, body);
nonterminal = NODE_TYPE(void): 4 { reduction action; }
nonterminal = NODE_TYPE(void): ManifestConstant { reduction action; }
nonterminal = NODE_TYPE(void): computedCost(getNode()) { reduction action; }
Wiki: CommandLineOptions
Wiki: CostExpressionsGuide
Wiki: Debugging
Wiki: DirectivesGuide
Wiki: JBurgIncludeGuide
Wiki: PatternRuleGuide
Wiki: ReductionActionsGuide
Wiki: TransformationRuleGuide
Wiki: antbuild