.TH TWIG 1 .CT 1 prog_other .SH NAME twig \- tree-manipulation language .SH SYNOPSIS .B twig [ .B -w\fIxx\fP ] .I file\f8.mt\fP .SH DESCRIPTION .I Twig converts a tree-specification scheme consisting of pattern-action rules with associated costs into C functions that can be called to manipulate input trees. The C functions first find a minimum-cost covering of an input tree using a dynamic programming algorithm and then execute the actions associated with the patterns used in the covering. The tree-specification scheme may allow several coverings for an input tree, but the dynamic programming algorithm resolves any ambiguities by selecting a cheapest covering. .PP The input file containing the tree-specification scheme must have the suffix .LR .mt . .I Twig produces two output files: .FR walker.c , which becomes the source file for the tree matcher, and .FR symbols.h , which contains the definitions for the node and label symbols used in the source file. .PP To build .FR walker.c , .I twig uses an internal template file called .FR walker.\fIxx\fR where \fIxx\fR is the argument of the optional .B -w flag. If the flag is omitted, then \fIxx\fR defaults to .LR c1 . .SH FILES .TF symbols.h .TP .F file.mt input file .TP .F walker.c output tree matcher .TP .F symbols.h definitions of node and label symbols .SH "SEE ALSO" .IR yacc (1) .br S. W. K. Tjiang, .I "The Twig Reference Manual," Computing Science Technical Report No. 120, AT&T Bell Laboratories, Murray Hill, N.J. .br A. V. Aho, M. Ganapathi, and S. W. K. Tjiang, .I "Code generation using tree matching and dynamic programming." .SH BUGS When tree matching fails, the debugging output is cryptic.