|
|
1.1 root 1: .TH TWIG 1
2: .SH NAME
3: twig \- tree-manipulation language
4: .SH SYNOPSIS
5: .B twig
6: [
7: .B -sASC
8: ]
9: [
10: .BI -w " suffix"
11: ]
12: .I file.mt
13: .SH DESCRIPTION
14: .I Twig
15: converts a tree-specification scheme consisting of pattern-action
16: rules with associated costs into C functions that can be called
17: to manipulate input trees.
18: The C functions first find a minimum-cost covering of an input tree
19: using a dynamic programming algorithm and then execute
20: the actions associated with the patterns used in the covering.
21: The tree-specification scheme may allow several coverings for an input tree,
22: but the dynamic programming algorithm resolves any ambiguities
23: by selecting a cheapest covering.
24: .PP
25: The input file containing the tree-specification scheme
26: must have the suffix
27: .LR .mt .
28: .I Twig
29: produces two output files:
30: .BR walker.c ,
31: which becomes the source file for the tree matcher, and
32: .BR symbols.h ,
33: which contains the definitions for the node and label symbols used
34: in the source file.
35: .PP
36: To build
37: .BR walker.c ,
38: .I twig
39: uses an internal template file,
40: by default one appropriate for use with
41: .IR fprintf (2).
42: .PP
43: The options are
44: .TP "\w'\fL-w \fIsuffix\fLXX'u"
45: .B -A
46: Use a template file for ANSI/POSIX source files.
47: .TP
48: .B -C
49: Use a template file for files that use libc's
50: .IR print (2)
51: routines.
52: .TP
53: .B -S
54: Use a template file for files that use
55: .IR fprintf (2).
56: .TP
57: .B -s
58: Do not produce a
59: .B symbols.h
60: file.
61: .TP
62: .BI -w " suffix"
63: Use the template file
64: .BI /sys/lib/twig/walker. suffix\f1.
65: .SH FILES
66: .TF /sys/lib/twig
67: .TP
68: .B /sys/lib/twig
69: System area for template files.
70: .SH SOURCE
71: .B /sys/src/cmd/twig
72: .SH "SEE ALSO"
73: .IR yacc (1)
74: .br
75: S. W. K. Tjiang,
76: ``The Twig Reference Manual'',
77: .I
78: Computing Science Technical Report No. 120,
79: AT&T Bell Laboratories,
80: Murray Hill, N.J.
81: .br
82: A. V. Aho, M. Ganapathi, and S. W. K. Tjiang,
83: ``Code generation using tree matching and dynamic programming.''
84: .SH BUGS
85: When tree matching fails, the debugging output is cryptic.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.