summaryrefslogtreecommitdiff
path: root/static/v10/man1/twig.1
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 21:07:28 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2026-04-25 21:07:28 -0400
commit711594636704defae873be1a355a292505585afd (patch)
tree59ee13f863830d8beba6cfd02bbe813dd486c26f /static/v10/man1/twig.1
parent3258a063c1f189d7b019e40e525b46bef9b9a7b1 (diff)
docs: Added UNIX V10 Manuals
Diffstat (limited to 'static/v10/man1/twig.1')
-rw-r--r--static/v10/man1/twig.167
1 files changed, 67 insertions, 0 deletions
diff --git a/static/v10/man1/twig.1 b/static/v10/man1/twig.1
new file mode 100644
index 00000000..23965f92
--- /dev/null
+++ b/static/v10/man1/twig.1
@@ -0,0 +1,67 @@
+.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.