Witam. Zacząłem uczyć się txl, jednak manual pozostawia bardzo wiele do życzenia. Miał ktoś z nim tutaj styczność?
Próbowałem zarejestrować się na forum txl ale czekam już długo na akceptację administratora i nic.

Zacząłem od prostej modyfikacji Cal.txl z katalogu examples - każde mnożenie chce włożyć w nawiasy.

% Part I.  Syntax specification
define program
        [expression]
end define

define expression
        [term]
    |   [expression] [addop] [term]
end define

define term
        [primary]
    |   [term] [mulop] [primary]
end define

define primary 
        [number]
    |   ( [expression] )
end define

define addop
        '+
    |   '-
end define

define mulop
        '*
    |   '/
end define


% Part 2.  Transformation rules
function main
    replace [program]
	P [program]
    by
	P [nest]
end function

rule nest
    replace $ [term]
	X1 [number] '* X2 [number]
    by
	(X1 '- X2)                                      % (X1 '* X2) <- nie działa - a to mój cel
end rule

Problem w tym że dostaję taki błąd: TXL0509E rule/function 'nest' - One pass rule failed to terminate (probable cause: part of replacement matches pattern)
bo jeśli dodam nawias wzór ciągle pasuje i reguła nigdy się nie kończy, to wymuszenie one pass jakoś źle działa.
Jak to naprawić?

Dla "1 + 2 * 3 + 64*9 - 2" chce dostać "1 + (2 * 3) + (64 * 9) - 2"

P.S. Wątpię żeby ktoś to tu znał no ale...