Looking through the PGE test examples, it *looks* like subrules are just globals. (so, if I
refer to <frob> in a rule, there should be a Match object in a global named
"frob")
e.g., from the PIR code generated for the phone test:
name = "digits"
subpat = "\\d+"
rulesub = p6rule_compile(subpat)
store_global name, rulesub
name = "exch"
subpat = "\\(<digits>\\)"
rulesub = p6rule_compile(subpat)
store_global name, rulesub
name = "_MASTER"
subpat = ":w<exch> <digits>-<digits>"
rulesub = p6rule_compile(subpat)
match = rulesub(target)
What if I want to use a namespace other than the root one, to avoid collision
with other rules? (I mean, I can store the rule in any global I want, but how
do I refer to the rule later on?) (especially for library modules, or your
compiler infrastructure, where you don't want to trounce a pre-existing rule in
the caller or the generated code)
Further, how does this interact with other globals in the same namespace? What if I have
a Tcl global called "digits"?
Regards?