— The Name in Software
Engineering Automation
In the rules below:
this indicates C pattern elements<this> indicates meta pattern
elementsNote that XTRAN automatically applies the rules below recursively to every expression in the code being re-engineered.
The following rules effectively convert infix expression notation to prefix notation.
| Original expression | Replacement expression |
|---|---|
<expr1> + <expr2>
|
add(<expr1>, <expr2>)
|
<expr1> - <expr2>
|
sub(<expr1>, <expr2>)
|
<expr1> * <expr2>
|
mul(<expr1>, <expr2>)
|
<expr1> / <expr2>
|
div(<expr1>, <expr2>)
|
<expr1> = <expr2>
|
copy(&<expr1>, <expr2>)
|
a = b + (c - d) * (e - f) / g;
copy(&a, add(b, div(mul(sub(c, d), sub(e, f)), g)));
In the following rules, the match of a "wildcard" pattern element is conditionalized with a Boolean expression; if the condition evaluates to false, the match fails at that element.
| Original expression | Replacement expression | Qualifying condition |
|---|---|---|
copy(<expr1>, <expr2>)
|
*<expr1> = <expr2>
|
<expr2> is not an
operator expression
|
copy(p_var1, *p_var2);
copy(p_var3, var4);
copy(p_var5, var6 + var7);
copy(p_var8 + 3, var9);
copy(p_var1, *p_var2);
*p_var3 = var4;
copy(p_var5, var6 + var7);
*(p_var8 + 3) = var9;
COPYRIGHT 2012; reproduction prohibited without permission. Revised 2009-09-11
XTRAN is a trademark of Pennington Systems Incorporated.
|
Pennington Systems Incorporated 2820 N. Pinal Avenue, Suite 12 Casa Grande, Arizona 85122-7927 USA |
Phone: +1(480)626-5503 Fax: +1(480)626-7618 Email: Info@Pennington.com Web: http://WWW.Pennington.com |