This is the ttt Reference Manual, version 2.1.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:58:29 2024 GMT+0.
ttt/ttt.asd
ttt/package.lisp
ttt/types.lisp
ttt/operators.lisp
ttt/expressions.lisp
ttt/keys.lisp
ttt/bindings.lisp
ttt/trees.lisp
ttt/patterns.lisp
ttt/operators/unrestricted-seq.lisp
ttt/operators/restricted-seq.lisp
ttt/operators/fpseq-gen.lisp
ttt/operators/descendant.lisp
ttt/operators/vertical.lisp
ttt/operators/literal.lisp
ttt/sticky.lisp
ttt/predicates.lisp
ttt/template-construction.lisp
ttt/transductions.lisp
ttt/util.lisp
ttt/process-tb.lisp
ttt/search-tb.lisp
The main system appears first, followed by any subsystem dependency.
ttt
A language for transparent modifications of s-expression based trees.
Adam Purtee and Gene Louis Kim <gkim21@cs.rochester.edu>
GPLv3
2.1.0
bordeaux-threads
(system).
package.lisp
(file).
types.lisp
(file).
operators.lisp
(file).
expressions.lisp
(file).
keys.lisp
(file).
bindings.lisp
(file).
trees.lisp
(file).
patterns.lisp
(file).
operators/unrestricted-seq.lisp
(file).
operators/restricted-seq.lisp
(file).
operators/fpseq-gen.lisp
(file).
operators/descendant.lisp
(file).
operators/vertical.lisp
(file).
operators/literal.lisp
(file).
sticky.lisp
(file).
predicates.lisp
(file).
template-construction.lisp
(file).
transductions.lisp
(file).
util.lisp
(file).
process-tb.lisp
(file).
search-tb.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
ttt/ttt.asd
ttt/package.lisp
ttt/types.lisp
ttt/operators.lisp
ttt/expressions.lisp
ttt/keys.lisp
ttt/bindings.lisp
ttt/trees.lisp
ttt/patterns.lisp
ttt/operators/unrestricted-seq.lisp
ttt/operators/restricted-seq.lisp
ttt/operators/fpseq-gen.lisp
ttt/operators/descendant.lisp
ttt/operators/vertical.lisp
ttt/operators/literal.lisp
ttt/sticky.lisp
ttt/predicates.lisp
ttt/template-construction.lisp
ttt/transductions.lisp
ttt/util.lisp
ttt/process-tb.lisp
ttt/search-tb.lisp
ttt/types.lisp
package.lisp
(file).
ttt
(system).
tree-expr
(type).
ttt/operators.lisp
types.lisp
(file).
ttt
(system).
*invalid-suffix-chars*
(special variable).
*operation-table*
(special variable).
*operator-lock*
(special variable).
add-op
(function).
get-/m
(function).
get-/n
(function).
get-op
(function).
get-var
(function).
literal?
(function).
mk-var
(function).
op-is-pred?
(function).
op-requires-args?
(function).
pred-sym-p
(function).
purge-op
(function).
sticky?
(function).
valid-op-suffix
(function).
variable?
(function).
ttt/expressions.lisp
operators.lisp
(file).
ttt
(system).
expr-height
(function).
filter-ops
(function).
keys-to-filter-ops
(function).
listify
(function).
patt-expr-get-op
(function).
patt-expr-get-var
(function).
patt-expr-max-width
(function).
patt-expr-min-width
(function).
patt-expr-neg-args
(function).
patt-expr-pos-args
(function).
ttt/keys.lisp
expressions.lisp
(file).
ttt
(system).
add-to-index
(function).
extract-keys
(function).
fastmap
(function).
index
(reader method).
(setf index)
(writer method).
index
(class).
make-index
(function).
ttt/bindings.lisp
keys.lisp
(file).
ttt
(system).
add-binding
(function).
bind-seq
(function).
bind-var
(function).
bound?
(function).
get-binding
(function).
mk-binding
(function).
mk-tmp
(function).
nadd-binding
(function).
satisfies-constraints
(function).
ttt/trees.lisp
bindings.lisp
(file).
ttt
(system).
build-tree
(function).
children
(reader method).
(setf children)
(writer method).
dfs-order
(reader method).
(setf dfs-order)
(writer method).
height
(reader method).
(setf height)
(writer method).
keys
(reader method).
(setf keys)
(writer method).
leaf?
(method).
nchildren
(reader method).
(setf nchildren)
(writer method).
parent
(reader method).
(setf parent)
(writer method).
parent-idx
(reader method).
(setf parent-idx)
(writer method).
to-expr
(reader method).
(setf to-expr)
(writer method).
to-subtrees
(reader method).
(setf to-subtrees)
(writer method).
tree
(class).
update-dfs-order
(method).
update-subtree-index
(method).
ttt/patterns.lisp
trees.lisp
(file).
ttt
(system).
match-expr
(function).
*built-patterns*
(special variable).
*pattern-lock*
(special variable).
*ttt-debug-level*
(special variable).
build-pattern
(function).
compiled?
(reader method).
(setf compiled?)
(writer method).
deep-match
(method).
deep-match-brute
(function).
deepest-matches
(method).
deepest-matches-brute
(function).
has-depth-constraints
(class).
has-iter-constraints
(class).
has-neg-args
(class).
has-pos-args
(class).
initialized?
(reader method).
(setf initialized?)
(writer method).
keys
(reader method).
(setf keys)
(writer method).
match
(method).
match-encap
(function).
match-fn
(reader method).
(setf match-fn)
(writer method).
max-depth
(reader method).
(setf max-depth)
(writer method).
max-height
(reader method).
(setf max-height)
(writer method).
max-iter
(reader method).
(setf max-iter)
(writer method).
max-width
(reader method).
(setf max-width)
(writer method).
min-depth
(reader method).
(setf min-depth)
(writer method).
min-height
(reader method).
(setf min-height)
(writer method).
min-iter
(reader method).
(setf min-iter)
(writer method).
min-width
(reader method).
(setf min-width)
(writer method).
neg-args
(reader method).
(setf neg-args)
(writer method).
pattern
(class).
pos-args
(reader method).
(setf pos-args)
(writer method).
to-expr
(reader method).
(setf to-expr)
(writer method).
var
(reader method).
(setf var)
(writer method).
ttt/operators/unrestricted-seq.lisp
patterns.lisp
(file).
ttt
(system).
compile-pattern
(method).
unrestricted-seq
(class).
ttt/operators/restricted-seq.lisp
operators/unrestricted-seq.lisp
(file).
ttt
(system).
compile-pattern
(method).
copy-rs-state
(function).
make-rs-state
(function).
restricted-seq
(class).
rs-state
(structure).
rs-state-a
(reader).
(setf rs-state-a)
(writer).
rs-state-binds
(reader).
(setf rs-state-binds)
(writer).
rs-state-m
(reader).
(setf rs-state-m)
(writer).
rs-state-n
(reader).
(setf rs-state-n)
(writer).
rs-state-p
(function).
rs-state-tseq
(reader).
(setf rs-state-tseq)
(writer).
ttt/operators/fpseq-gen.lisp
operators/restricted-seq.lisp
(file).
ttt
(system).
compile-helper
(function).
compile-pattern
(method).
compile-pattern
(method).
compile-pattern
(method).
copy-h-state
(function).
free-seq
(class).
general-patt
(class).
h-state
(structure).
h-state-binds
(reader).
(setf h-state-binds)
(writer).
h-state-p
(function).
h-state-pseq
(reader).
(setf h-state-pseq)
(writer).
h-state-tseq
(reader).
(setf h-state-tseq)
(writer).
make-h-state
(function).
permuted-seq
(class).
ttt/operators/descendant.lisp
operators/fpseq-gen.lisp
(file).
ttt
(system).
compile-pattern
(method).
copy-d-state
(function).
d-state
(structure).
d-state-depth
(reader).
(setf d-state-depth)
(writer).
d-state-node
(reader).
(setf d-state-node)
(writer).
d-state-p
(function).
descendant-patt
(class).
make-d-state
(function).
ttt/operators/vertical.lisp
operators/descendant.lisp
(file).
ttt
(system).
compile-pattern
(method).
compile-pattern
(method).
copy-v-state
(function).
ensure-compiled
(function).
make-v-state
(function).
next-v-states
(function).
point-of-attachment
(class).
v-state
(structure).
v-state-binds
(reader).
(setf v-state-binds)
(writer).
v-state-leading-vars
(reader).
(setf v-state-leading-vars)
(writer).
v-state-p
(function).
v-state-pargs
(reader).
(setf v-state-pargs)
(writer).
v-state-tseq
(reader).
(setf v-state-tseq)
(writer).
vertical-patt
(class).
ttt/operators/literal.lisp
operators/vertical.lisp
(file).
ttt
(system).
compile-pattern
(method).
literal-patt
(class).
ttt/sticky.lisp
operators/literal.lisp
(file).
ttt
(system).
compile-pattern
(method).
stuck-patt
(class).
wrap-sticky-check
(function).
ttt/predicates.lisp
sticky.lisp
(file).
ttt
(system).
store-pred
(function).
*predicate-lock*
(special variable).
*predicate-table*
(special variable).
get-pred-fn
(function).
get-pred-instance
(function).
match
(method).
mk-pred-ttt
(function).
patt
(reader method).
(setf patt)
(writer method).
predicate-patt
(class).
ttt-pred
(reader method).
(setf ttt-pred)
(writer method).
ttt/template-construction.lisp
predicates.lisp
(file).
ttt
(system).
*next-int-lock*
(special variable).
*subst-new-next-int*
(special variable).
apply!
(function).
concatenate-syms!
(function).
deep-substitute
(function).
join-with-dash!
(function).
subst-new!
(function).
template-to-tree
(function).
ttt/transductions.lisp
template-construction.lisp
(file).
ttt
(system).
apply-rule
(function).
apply-rules
(function).
compile-pattern
(method).
copy-t-bind
(function).
do-transduction
(function).
get-matches
(function).
lhs
(reader method).
(setf lhs)
(writer method).
make-t-bind
(function).
rhs
(reader method).
(setf rhs)
(writer method).
t-bind
(structure).
t-bind-p
(function).
t-bind-parent
(reader).
(setf t-bind-parent)
(writer).
t-bind-parent-idx
(reader).
(setf t-bind-parent-idx)
(writer).
t-bind-template-expr
(reader).
(setf t-bind-template-expr)
(writer).
transduction
(class).
ttt/util.lisp
transductions.lisp
(file).
ttt
(system).
hide-ttt-ops
(function).
ttt-all-rule-results
(function).
ttt-apply-rule-possibilities
(function).
unhide-ttt-ops
(function).
lispify-parser-output
(function).
preslash-unsafe-chars
(function).
ttt/process-tb.lisp
util.lisp
(file).
ttt
(system).
process-tb
(function).
ttt/search-tb.lisp
process-tb.lisp
(file).
ttt
(system).
search-tb
(function).
Packages are listed by definition order.
ttt
the TTT (template to template transduction) package!
common-lisp
.
apply-rule
(function).
apply-rules
(function).
hide-ttt-ops
(function).
match-expr
(function).
store-pred
(function).
ttt-all-rule-results
(function).
ttt-apply-rule-possibilities
(function).
unhide-ttt-ops
(function).
*built-patterns*
(special variable).
*invalid-suffix-chars*
(special variable).
*next-int-lock*
(special variable).
*operation-table*
(special variable).
*operator-lock*
(special variable).
*pattern-lock*
(special variable).
*predicate-lock*
(special variable).
*predicate-table*
(special variable).
*subst-new-next-int*
(special variable).
*ttt-debug-level*
(special variable).
add-binding
(function).
add-op
(function).
add-to-index
(function).
apply!
(function).
bind-seq
(function).
bind-var
(function).
bound?
(function).
build-pattern
(function).
build-tree
(function).
children
(generic reader).
(setf children)
(generic writer).
compile-helper
(function).
compile-pattern
(generic function).
compiled?
(generic reader).
(setf compiled?)
(generic writer).
concatenate-syms!
(function).
copy-d-state
(function).
copy-h-state
(function).
copy-rs-state
(function).
copy-t-bind
(function).
copy-v-state
(function).
d-state
(structure).
d-state-depth
(reader).
(setf d-state-depth)
(writer).
d-state-node
(reader).
(setf d-state-node)
(writer).
d-state-p
(function).
deep-match
(generic function).
deep-match-brute
(function).
deep-substitute
(function).
deepest-matches
(generic function).
deepest-matches-brute
(function).
descendant-patt
(class).
dfs-order
(generic reader).
(setf dfs-order)
(generic writer).
do-transduction
(function).
ensure-compiled
(function).
expr-height
(function).
extract-keys
(function).
fastmap
(function).
filter-ops
(function).
free-seq
(class).
general-patt
(class).
get-/m
(function).
get-/n
(function).
get-binding
(function).
get-matches
(function).
get-op
(function).
get-pred-fn
(function).
get-pred-instance
(function).
get-var
(function).
h-state
(structure).
h-state-binds
(reader).
(setf h-state-binds)
(writer).
h-state-p
(function).
h-state-pseq
(reader).
(setf h-state-pseq)
(writer).
h-state-tseq
(reader).
(setf h-state-tseq)
(writer).
has-depth-constraints
(class).
has-iter-constraints
(class).
has-neg-args
(class).
has-pos-args
(class).
height
(generic reader).
(setf height)
(generic writer).
index
(generic reader).
(setf index)
(generic writer).
index
(class).
initialized?
(generic reader).
(setf initialized?)
(generic writer).
join-with-dash!
(function).
keys
(generic reader).
(setf keys)
(generic writer).
keys-to-filter-ops
(function).
leaf?
(generic function).
lhs
(generic reader).
(setf lhs)
(generic writer).
lispify-parser-output
(function).
listify
(function).
literal-patt
(class).
literal?
(function).
make-d-state
(function).
make-h-state
(function).
make-index
(function).
make-rs-state
(function).
make-t-bind
(function).
make-v-state
(function).
match
(generic function).
match-encap
(function).
match-fn
(generic reader).
(setf match-fn)
(generic writer).
max-depth
(generic reader).
(setf max-depth)
(generic writer).
max-height
(generic reader).
(setf max-height)
(generic writer).
max-iter
(generic reader).
(setf max-iter)
(generic writer).
max-width
(generic reader).
(setf max-width)
(generic writer).
min-depth
(generic reader).
(setf min-depth)
(generic writer).
min-height
(generic reader).
(setf min-height)
(generic writer).
min-iter
(generic reader).
(setf min-iter)
(generic writer).
min-width
(generic reader).
(setf min-width)
(generic writer).
mk-binding
(function).
mk-pred-ttt
(function).
mk-tmp
(function).
mk-var
(function).
nadd-binding
(function).
nchildren
(generic reader).
(setf nchildren)
(generic writer).
neg-args
(generic reader).
(setf neg-args)
(generic writer).
next-v-states
(function).
op-is-pred?
(function).
op-requires-args?
(function).
parent
(generic reader).
(setf parent)
(generic writer).
parent-idx
(generic reader).
(setf parent-idx)
(generic writer).
patt
(generic reader).
(setf patt)
(generic writer).
patt-expr-get-op
(function).
patt-expr-get-var
(function).
patt-expr-max-width
(function).
patt-expr-min-width
(function).
patt-expr-neg-args
(function).
patt-expr-pos-args
(function).
pattern
(class).
permuted-seq
(class).
point-of-attachment
(class).
pos-args
(generic reader).
(setf pos-args)
(generic writer).
pred-sym-p
(function).
predicate-patt
(class).
preslash-unsafe-chars
(function).
process-tb
(function).
purge-op
(function).
restricted-seq
(class).
rhs
(generic reader).
(setf rhs)
(generic writer).
rs-state
(structure).
rs-state-a
(reader).
(setf rs-state-a)
(writer).
rs-state-binds
(reader).
(setf rs-state-binds)
(writer).
rs-state-m
(reader).
(setf rs-state-m)
(writer).
rs-state-n
(reader).
(setf rs-state-n)
(writer).
rs-state-p
(function).
rs-state-tseq
(reader).
(setf rs-state-tseq)
(writer).
satisfies-constraints
(function).
search-tb
(function).
sticky?
(function).
stuck-patt
(class).
subst-new!
(function).
t-bind
(structure).
t-bind-p
(function).
t-bind-parent
(reader).
(setf t-bind-parent)
(writer).
t-bind-parent-idx
(reader).
(setf t-bind-parent-idx)
(writer).
t-bind-template-expr
(reader).
(setf t-bind-template-expr)
(writer).
template-to-tree
(function).
to-expr
(generic reader).
(setf to-expr)
(generic writer).
to-subtrees
(generic reader).
(setf to-subtrees)
(generic writer).
transduction
(class).
tree
(class).
tree-expr
(type).
ttt-pred
(generic reader).
(setf ttt-pred)
(generic writer).
unrestricted-seq
(class).
update-dfs-order
(generic function).
update-subtree-index
(generic function).
v-state
(structure).
v-state-binds
(reader).
(setf v-state-binds)
(writer).
v-state-leading-vars
(reader).
(setf v-state-leading-vars)
(writer).
v-state-p
(function).
v-state-pargs
(reader).
(setf v-state-pargs)
(writer).
v-state-tseq
(reader).
(setf v-state-tseq)
(writer).
valid-op-suffix
(function).
var
(generic reader).
(setf var)
(generic writer).
variable?
(function).
vertical-patt
(class).
wrap-sticky-check
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Apply a single rule to a tree expression until converged.
Returns a new tree expression.
shallow limits rule applications to root of tree
max-n limits the maximum number of edits to a tree
trace when t, displays debugging info to stdout
otherwise, when non-nil write debugging info to file
appending to the file if it already exists
format is (one triple of lines per transduction):
<tree before transduction>
<tree after transduction>
<blank line>
rule-depth
:default Rule application can occur at any depth, but only one match is
returned at each step.
:shallow Rule application can only occur at the root of the tree.
:deepest Rule application can occur at any depth, and all matches are
returned at each step. Setting a rule-depth value is recommended
when using this option to enable reasonable runtimes.
ttt
.
Apply each of the rules in list rules to a tree expression
until each rule is no longer applicable. The rules list is only
processed once. Returns a new tree expression.
shallow limits rule applications to root of tree (alternative to using
:rule-depth :shallow)
deepest allows multiple recursive matches into the tree at each step
(alternative to using :rule-depth :deepest)
max-n limits the maximum number of edits to a tree
trace when t, displays debugging info to stdout
otherwise, when non-nil write debugging info to file
appending to the file if it already exists
trace format is one 4-tuple of lines per transduction:
<rule expression>
<tree before transduction>
<tree after transduction>
<blank line>
rule-order
:slow-forward - apply each rule until that rule no longer
applies, possibly repeating the entire sequence
:earliest-first - always apply the first rule in the list that
is applicable, repeat until no rules are applicable
the rule list may be processed multiple times
:fast-forward - apply each rule at most once, in order, repeating
the list until convergence
rule-depth
:default Rule application can occur at any depth, but only one match is
returned at each step.
:shallow Rule application can only occur at the root of the tree.
:deepest Rule application can occur at any depth, and all matches are
returned at each step. Setting a rule-depth value is recommended
when using this option to enable reasonable runtimes. This rule
may only be used with rule-order :slow-forward. Behavior is
undefined for other rule-order options.
ttt
.
Added because the suffix expr is more meaningful than encap.
ttt
.
Nondestructively add the binding to bindings.
ttt
.
Insert op into the operation table. Associate the operation with match-fn. Optionally set predicate or requires-args booleans. (both default to nil)
ttt
.
add key/value pair to index. does not check for duplication of values. values may be stored in any order.
Applies the first argument to the rest of the arguments. This is a syntactic shortcut to avoid defining duplicates of lisp functions, but with the names ending in ’!’.
ttt
.
Builds a pattern object according to expression.
ttt
.
Convert a Lisp expression into a nodal tree.
This function should be optimized, because it will always
be called once per tree expression to be matched.
(Eg., 25k times for Brown, 5m times for BNC)
ttt
.
Compile general tree, free-standing, and permutation patterns.
ttt
.
Takes a free-standing sequence of symbols as arguments.
Returns the symbol which is the concatenation of their symbol names,
with dashes in between. Ex: (join-with-dash! ’X ’Y ’Z) => X-Y-Z
ttt
.
ttt
.
Matched a compiled pattern against a compiled tree object, each subtree is tested.
ttt
.
Recursively replace all occurences of olditem in sequence with newitem.
ttt
.
Matched a compiled pattern against a compiled tree object, each subtree is tested and a list of all results are returned.
ttt
.
Destructively modifies tree to implement the results of a previously bound transduction operator. Returns the modified tree.
ttt
.
return a list of keys, where each key is a cons of the form
(token . depth)
=> (extract-keys ’X)
((X . 0)
=> (extract-keys ’(S (NP (NN He)) (VP (VBZ Ran)) (|.| |.|)))
((S . 1) (NP . 2) (VP . 2) (|.| . 2))
=> (extract-keys ’(<> X Y (S (NP (NN He)) (VP (VBZ Ran)) (|.| |.|))))
((X . 0) (Y . 0) (S . 1) (NP . 2) (VP . 2) (|.| . 2))
This was re-implemented for better factoring and to eliminate
the depth 2 limit.
used as an accessor by build-tree to reverse the list
return filter-ops + finite-required-sets-of-ors for the same depth
=> (filter-ops ’((! PP-IN PP-WITH) _*))
(PP-IN PP-WITH)
((! S SBAR) _+) - fire only when S or SBAR encountered
((! S _+) _+) - fire on every tree
for patterns with choices (! ... +)
(! if this can only match symbols from a finite set, return that set
otherwise, return the empty set)
(+ if there exists a finite subset of symbols such that this rule
must match a symbol from within that set then return that set
what this buys us:
if (null (intersection (patt-keys expression) (tree-keys tree)))
then the pattern will fail to match tree
so that we can map from trees to applicable patterns:
(foreach sub-tree in tree do
(dolist (key (tree-keys sub-tree))
(dolist (pattern (gethash key *rules-by-key*))
(let ((bindings (match pattern sub-tree)))
(if bindings (print ’successful-match))))))
re-ranker parses of Brown have an average of 2.85 keys per sub-tree
return a list of the freestanding elements
=> (filter-ops ’(<> X Y))
(X Y)
=> (filter-ops ’(X Y))
((X Y))
could extend to filter-all - return ALL such sets to any depth
maxdepth stops this process at a specific depth. If an operator set includes
subtrees beyond the depth, the whole pattern is omitted.
ttt
.
Return the binding for variable bvar in bindings.
ttt
.
Runes the compiled pattern agains a compiled tree object with the given
rule-depth option. This is a helper function for apply-rule and apply-rules
and does not check any of the inputs.
Returns a list of matched subtrees.
ttt
.
Return the operation associated with sym.
If sym is a variable then return the symbol which corresponds
to the variable with additional binding information stripped.
The operation is stored in sym’s property list to avoid
future textual searching. If sym is a list or represents a literal then
return nil.
ttt
.
Return the function for the base predicate symbol.
ttt
.
returns the thing which should be bound-to in the case of variables (and predicates); returns nil in the case of a variable, a literal, or a list
ttt
.
ttt
.
Takes a free-standing sequence of symbols as arguments.
Returns the symbol which is the concatenation of their symbol names,
with dashes in between. Ex: (join-with-dash! ’X ’Y ’Z) => X-Y-Z
ttt
.
for handling predicates. a crutch.
switch from ((A.0) (B.0) (C.1) (D.2) (E.2)) to (A B (C) (D E))
ttt
.
Match a pattern expression against a tree expression.
ttt
.
Defines a predicate function within the TTT package. The predicate operator will be interned to TTT and lose the package it is in when called. TODO: make a version that is more general to other packages.
ttt
.
Destructively add the binding to bindings.
ttt
.
Return t if the operation is a predicate. Nil otherwise.
ttt
.
Return t if the operation requires args (!,+,*,?,{},<>,^,^n,^*,^+,^@). Nil otherwise (_!,_+,_*,_?).
ttt
.
If an operator exists which handles the particular pattern,
then return the proper operator,
otherwise return literal for tree literals or general for nonliterals.
ttt
.
If the top-level pattern should be bound, return the variable.
ttt
.
Given patt = ’(op X1 X1 ... Xm ~ Y1 Y2 ... Yn) return ’(Y1 Y2 ... Yn)
ttt
.
Given patt = ’(op X1 X2 ... Xm ~ Y1 Y2 ... Yn) return ’(X1 X2 ... Xm)
ttt
.
Check to see if the symbol is a predicate optionally followed by digits.
ttt
.
Apply a set of rules to a treebank.
treebank-file should be consist of one parse tree per line.
ruleset should be a list of TTT rules in expression form
note: Lisp will change (CD 0600) to (CD 600).
ttt
.
ttt
.
Patt-expr should be a basic s-expression. treebank-file should be an open steam.
ttt
.
Return true if the atomic symbol op represents a sticky variable; memoize the result.
ttt
.
Replaces every occurence of symbol sym in expr with a single new symbol, which is created by appending a period and an integer onto the symbol-name of sym. Ex: (subst-new! ’X (A X (X))) => (A X.1 (X.1))
ttt
.
ttt
.
ttt
.
ttt
.
Build a new tree expression from template-expression and bindings. When return-expr is nil, a tree object is returned instead.
ttt
.
ttt
.
ttt
.
ttt
.
Added so that ** isn’t parsed as an operator with suffix *
ttt
.
ttt
.
transduction
)) ¶stuck-patt
)) ¶literal-patt
)) ¶Tree is a tree in Lisp expression form: E.g, (X (Y) (Z))
tree-seq is a list of instances of class tree, results of build-tree
For efficiency, compile-tree-literal expects tree objects to have constant time access to their underlying expression through to-expr. Similarly, pattern is expected to be an instance of class pattern, and to represent a tree literal. The underlying literal should be able to be accessed in constant time through to-literal.
point-of-attachment
)) ¶vertical-patt
)) ¶descendant-patt
)) ¶Compile patterns with operators ^ ^^ ^* ^n
general-patt
)) ¶permuted-seq
)) ¶restricted-seq
)) ¶Set the match-fn for restricted sequence pattern patt.
unrestricted-seq
)) ¶Set the match-fn for unrestriced sequence pattern patt.
ttt
.
transduction
)) ¶automatically generated reader method
lhs
.
ttt
.
transduction
)) ¶automatically generated writer method
lhs
.
ttt
.
predicate-patt
) tree-seq bindings) ¶Predicates do not access or modify bindings.
ttt
.
has-depth-constraints
)) ¶automatically generated reader method
ttt
.
has-depth-constraints
)) ¶automatically generated writer method
ttt
.
has-iter-constraints
)) ¶automatically generated reader method
ttt
.
has-iter-constraints
)) ¶automatically generated writer method
ttt
.
has-depth-constraints
)) ¶automatically generated reader method
ttt
.
has-depth-constraints
)) ¶automatically generated writer method
ttt
.
has-iter-constraints
)) ¶automatically generated reader method
ttt
.
has-iter-constraints
)) ¶automatically generated writer method
ttt
.
has-neg-args
)) ¶automatically generated reader method
ttt
.
has-neg-args
)) ¶automatically generated writer method
ttt
.
predicate-patt
)) ¶automatically generated reader method
patt
.
ttt
.
predicate-patt
)) ¶automatically generated writer method
patt
.
ttt
.
has-pos-args
)) ¶automatically generated reader method
ttt
.
has-pos-args
)) ¶automatically generated writer method
ttt
.
transduction
)) ¶automatically generated reader method
rhs
.
ttt
.
transduction
)) ¶automatically generated writer method
rhs
.
ttt
.
predicate-patt
)) ¶automatically generated reader method
ttt
.
predicate-patt
)) ¶automatically generated writer method
Descendant pattern of form:
(^ P1 P2 ... Pp ~ N1 N2 ... Nn)
(^* P1 P2 ... Pp ~ N1 N2 ... Nn)
(^+ P1 P2 ... Pp ~ N1 N2 ... Nn)
(^n P1 P2 ... Pp ~ N1 N2 ... Nn)
(^^ P1 P2 ... Pp ~ N1 N2 ... Nn)
ttt
.
Free standing sequence of form: (<> P1 P2 ... Pp)
ttt
.
General tree pattern: (_+ X Y _! Z)
ttt
.
Tree-literal pattern (e.g, a pattern involving no operators)
ttt
.
General class representing properties common to all patterns,
such as min/max matchable tree sequence width, and operator type.
This is a purely abstract class, not meant to be instantiated directly.
A pattern is a static object and should not be modified
after construction.
The constructors for descendant patterns should initialze match-fn to either a generic (interpreted) function or compiled function which is unique to the pattern object.
ttt
.
(setf compiled?)
.
compiled?
.
deep-match
.
deepest-matches
.
(setf initialized?)
.
initialized?
.
(setf keys)
.
keys
.
match
.
(setf match-fn)
.
match-fn
.
(setf max-height)
.
max-height
.
(setf max-width)
.
max-width
.
(setf min-height)
.
min-height
.
(setf min-width)
.
min-width
.
(setf to-expr)
.
to-expr
.
(setf var)
.
var
.
fixnum
0
:min-width
fixnum
most-positive-fixnum
:max-width
fixnum
0
fixnum
most-positive-fixnum
:initialized?
ttt::tree-expr
function
Permuted sequence of form: ({} P1 P2 ... Pp)
ttt
.
A predicate may only match tree-sequences of length 1. Their only arguments should be a tree sequence. They do not modify bindings.
Restricted sequences of general forms:
(![n] P1 ... Pp ~ N1 ... Nn)
(+[n] P1 ... Pp ~ N1 ... Nn)
(?[n] P1 ... Pp ~ N1 ... Nn)
(*[n-m] P1 ... Pp ~ N1 ... Nn)
The iterative constraints and negated arguments are optional. When there are no negated arguments, the ~ should be omitted. A special case is: (! ~ N1 ... Nn), which matches any tree which does not match any of the negated arguments.
ttt
.
A class for matching free-standing sticky variables associated with operators which would typically require arugments and which can be sticky. I.e., ! + * ? <> {} ^ ^* ^@).
ttt
.
Returns special bindings.
one transduction operator per rule
no named variables (no sticky)
cannot be in iterated context
must match sequence of length 1
must replace with sequence of length 1
ttt
.
ttt::tree-expr
ttt::tree-expr
fixnum
fixnum
Unrestricted sequences of general forms:
_![n] _+[n] _?[n] _*[n-m]
with stickied, named syntax:
_!.[n]var _+.[n]var _?.[n]var _*.[n-m]var
matching a sequence of length
exactly n, at least n, at most n,
and between n and m, respectively.
ttt
.
Vertical path of form:
(^@ P1 P2 ... Pp ~ N1 N2 ... Nn)
ttt
.
Jump to: | (
A B C D E F G H I J K L M N O P R S T U V W |
---|
Jump to: | (
A B C D E F G H I J K L M N O P R S T U V W |
---|
Jump to: | *
A B C D H I K L M N P R S T V |
---|
Jump to: | *
A B C D H I K L M N P R S T V |
---|
Jump to: | B C D E F G H I K L O P R S T U V |
---|
Jump to: | B C D E F G H I K L O P R S T U V |
---|