1Mono(Mono 1.0)                                                  Mono(Mono 1.0)
2
3
4

NAME

6       monoburg - code generator generator
7

SYNOPSIS

9       monoburg [-h] [-e] [-p] [-c VALUE] [-d HEADER] [-DVALUE] [FILE...]
10

DESCRIPTION

12       The  monoburg  program  is  used to generate tree pattern matchers from
13       BURG specifications. monoburg accepts the following EBNF grammar.
14
15              spec:      ccode `%%' { dcl } [`%%' ccode]
16
17              dcl:       `%start' nonterm
18                         `%term' { identifier [`=' integer] }
19                         `%termprefix' { identifier }
20                         nonterm `:' tree [cost] [ `{' ccode `}' ] [costfunc]
21
22              tree:      term `(' tree `,' tree `)'
23                         term `(' tree `)'
24                         term
25                         nonterm
26
27              cost:      `"' string '"'
28                         integer
29
30              costfunc: `cost' `{' ccode `}'
31
32       Where ccode is arbitrary C code. cost and costfunc  are  used  mutually
33       exclusive, you can't use both in one rule. cost must be a C expression,
34       whereas ccode inside costfunc is the body of a  C  function.  Here  are
35       some example rules:
36
37              # define some terminal
38              %term Fetch Four Mul Plus
39
40              # this rule uses fixed costs
41              addr: Plus (con, Mul (Four, reg)) 2
42              {
43                      printf ("Emit your code here.");
44              }
45
46              # this one computes costs inside a function
47              reg:  Fetch (addr)
48              {
49                      printf ("Tree address is %p", tree);
50
51              } cost {
52                   int c;
53
54                   c = 1; /* calculate the costs here */
55
56                   return c;
57              }
58
59       A  simple  pre-processor  is included, consisting of: %ifdef, %else and
60       %endif.  %ifdef operates on definitions from the command line.
61

OPTIONS

63       The following options are supported:
64
65       -h     Displays usage instructions.
66
67       -d HEADER
68              Writes a separate header file which contains all monoburg  defi‐
69              nitions.
70
71       -p     Assume  termainals are already defined. Its possible to omit the
72              %term definitions in this mode if you use the  %termprefix  com‐
73              mand.  All symbols starting with a prefix specified in %termpre‐
74              fix are considered to be terminals.
75
76       -e     Extended mode. Enables monoburg to work with DAGs.
77
78       -c VALUE
79              Set the default costs to VALUE
80
81       -Dvar  Defines the variable "var" as true.  This is used  with  %ifdef,
82              %else and %endif in the source files to perform conditional com‐
83              pilation.
84

AUTHOR

86       monoburg was written by Dietmar Maurer. It is based on the papers  from
87       Christopher  W. Fraser, Robert R. Henry and Todd A. Proebsting: "BURG -
88       Fast Optimal Instruction Selection and Tree Parsing" and "Engineering a
89       Simple, Efficient Code Generator Generator".
90

SEE ALSO

92       monodis(1) pedump(1)
93
94
95
96                                                                Mono(Mono 1.0)
Impressum