2 .\" monoburg manual page.
5 .\" Dietmar Maurer (dietmar@ximian.com)
9 monoburg \- code generator generator
17 The \fImonoburg\fP program is used to generate tree pattern matchers
18 from BURG specifications. \fImonoburg\fP accepts the following EBNF grammar.
23 spec: ccode `%%' { dcl } [`%%' ccode]
26 `%term' { identifier [`=' integer] }
27 nonterm `:' tree [cost] [ `{' ccode `}' ] [costfunc]
29 tree: term `(' tree `,' tree `)'
37 costfunc: `cost' `{' ccode `}'
41 Where \fIccode\fP is arbitrary C code. \fIcost\fP and \fIcostfunc\fP are
42 used mutually exclusive, you can't use both in one rule. \fIcost\fP must be a C
43 expression, whereas \fIccode\fP inside \fIcostfunc\fP is the body of a C
44 function. Here are some example rules:
49 # define some terminal
50 %term Fetch Four Mul Plus
52 # this rule uses fixed costs
53 addr: Plus (con, Mul (Four, reg)) 2
55 printf ("Emit your code here.");
58 # this one computes costs inside a function
61 printf ("Tree address is %p", tree);
66 c = 1; /* calculate the costs here */
75 The following options are supported:
78 Displays usage instructions.
81 Writes a separate header file which contains all monoburg definitions.
84 monoburg was written by Dietmar Maurer. It is based on the papers from
85 Christopher W.\ Fraser, Robert R.\ Henry and Todd A.\ Proebsting:
86 "BURG - Fast Optimal Instruction Selection and Tree Parsing" and
87 "Engineering a Simple, Efficient Code Generator Generator".