Mono(Mono 1.0)

NAME
monoburg - code generator generator

SYNOPSIS

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

DESCRIPTION
The monoburg program is used to generate tree pattern matchers from BURG specifications. monoburg accepts the following EBNF grammar.

    spec:      ccode `%%' { dcl } [`%%' ccode]
    dcl:       `%start' nonterm
               `%term' { identifier [`=' integer] }
               `%termprefix' { identifier }
               nonterm `:' tree [cost] [ `{' ccode `}' ] [costfunc]
    tree:      term `(' tree `,' tree `)'
               term `(' tree `)'
               term
               nonterm
    cost:      `"' string '"'
               integer
    costfunc: `cost' `{' ccode `}'

Where ccode is arbitrary C code. cost and costfunc are used mutually exclusive, you can't use both in one rule. cost must be a C expression, whereas ccode inside costfunc is the body of a C function. Here are some example rules:

    # define some terminal
    %term Fetch Four Mul Plus
    # this rule uses fixed costs
    addr: Plus (con, Mul (Four, reg)) 2
    {
            printf ("Emit your code here.");
    }
    # this one computes costs inside a function
    reg:  Fetch (addr)
    {
            printf ("Tree address is %p", tree);
    } cost {
    	int c;
    	c = 1; /* calculate the costs here */
    	return c;
    }

OPTIONS
The following options are supported:

-h  Displays usage instructions.

-d HEADER
    Writes a separate header file which contains all monoburg definitions.

-p  Assume termainals are already defined. Its possible to omit the %term definitions in this mode if you use the %termprefix command. All symbols starting with a prefix specified in %termprefix are considered to be terminals.

-e  Extended mode. Enables monoburg to work with DAGs.

-c VALUE
    Set the default costs to VALUE

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

SEE ALSO
monodis(1) pedump(1)