( Tu Rules framework  Rob Chapman  July 1, 1997 )

RULE-SET curly-pattern
RULE-SET control
RULE-SET substitution

RULE-SET rulefind
{ }[ inputq PULL DROP ]
| { |[ curly-pattern RULES ]
{ [ }[ control RULES ]

| } |[ ?CR ." Error: end of phrase at line# " line-no @ 1 - . ]
| }{ |[ ?CR ." Error: middle phrase at line# " line-no @ 1 - . ]
| }[ |[ ?CR ." Error: pattern end at line# " line-no @ 1 - . ]
| ]{ || ] |[ ?CR ." Error: action end at line# " line-no @ 1 - . ]

RULE-SET curly-patterns
| } |[ rulefind RULES ]

curly-pattern RULES
{ }[ inputq PULL DROP ]
| } |[ ?CR ." Form 5: recognition at line# " line-no @ . rulefind RULES ]
| }{ |[ curly-pattern RULES curly-patterns >RULES ]
| }[ |[ control RULES ]

| { |[ ?CR ." nested Rule at line# " line-no @ . ]
| ]{ |[ ?CR ." action terminator at line# " line-no @ . ]

control RULES
{ }[ inputq PULL DROP ]
| ] |[ rulefind RULES ]
| ]{ |[ substitution RULES ]

| [ |[ ?CR ." Interpret mode at line# " line-no @ . ]
| { || } |[ ?CR ." Curlies seen in control at line# " line-no @ . ]

substitution RULES
{ }[ inputq PULL DROP ]
| } |[ rulefind RULES ]

| }[ |[ ?CR ." Error: curly action at line# " line-no @ . rulefind RULES ]
| }{ |[ ?CR ." Error: curlies at line# " line-no @ . rulefind RULES ]
| { |[ ?CR ." Error: curly at line# " line-no @ . rulefind RULES ]
| ]{ |[ ?CR ." Error: action terminator at line# " line-no @ . rulefind RULES ]

: TRANSLATOR-INIT ( -- ) TRANSLATOR-INIT rulefind RULES ;

CLOSE
Possible Tu
[
]

{
}
}{
}[
]{

|
||
|[
]|