blob: 340b57ac56a582c197db7a7588df83db0e5a9f68 [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.2.5.&nbsp;Update Rule</title><link href="style.css" rel="stylesheet" type="text/css"><meta content="DocBook XSL Stylesheets V1.72.0" name="generator"><link rel="start" href="index.html" title="The VIATRA2 Model Transformation Framework"><link rel="up" href="sec_ASMSimpleRules.html" title="4.2.&nbsp;Simple ASM Rules"><link rel="prev" href="def_FailRule.html" title="4.2.4.&nbsp;Fail Rule"><link rel="next" href="def_PrintRule.html" title="4.2.6.&nbsp;Print Rule"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table summary="Navigation header" width="100%"><tr><th align="center" colspan="3">4.2.5.&nbsp;Update Rule</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="def_FailRule.html">Prev</a>&nbsp;</td><th align="center" width="60%">4.2.&nbsp;Simple ASM Rules</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="def_PrintRule.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_UpdateRule"></a>4.2.5.&nbsp;Update Rule</h4></div></div></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip: Description"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left"><a name="def_UpdateRule_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
An <span class="strong"><strong>update rule</strong></span><a name="N11368" class="indexterm"></a>is used to modify the value of an already defined
variable or the value assigned to a specific location of an ASM function.
</p></td></tr></table></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important: Syntax"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Important]" src="images/important.png"></td><th align="left"><a name="def_UpdateRule_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
UpdateRuleAST ::= <span class="token">update</span> <a href="def_Variable.html" title="5.7.2.&nbsp;Variable">VariableRefAST</a> <span class="token">=</span> <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">ArithmeticTermAST</a> <span class="token">;</span>
| <span class="token">update</span> AsmFunctionUpdateLocationAST <span class="token">=</span> <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">ArithmeticTermAST</a> <span class="token">;</span>
AsmFunctionUpdateLocationAST ::= ASMFunctionNameAST <a href="def_ActualParameter.html" title="5.8.3.&nbsp;Actual Parameters">ActualParameterDefAST</a>
ASMFunctionNameAST ::= <a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">ValueQualifiedNameAST</a>
</pre></td></tr></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note: Semantics"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left"><a name="def_UpdateRule_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
The value of the <a href="def_Variable.html" title="5.7.2.&nbsp;Variable">variable</a> or the <a href="def_AsmFunctionLocation.html" title="5.5.3.&nbsp;ASM Function Location">ASM function location</a>referred by the <span class="strong"><strong>update rule</strong></span><a name="N113AB" class="indexterm"></a>is updated to the value
resulting from the evaluation of the ASM <a href="def_ArithmeticTerm.html" title="5.3.1.&nbsp;Arithmetic Term">arithmetic term</a>.
</p></td></tr></table></div><div class="caution" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Caution: Constraints"><tr><td valign="top" align="center" rowspan="2" width="25"><img alt="[Caution]" src="images/caution.png"></td><th align="left"><a name="def_UpdateRule_Constraints"></a>Constraints</th></tr><tr><td valign="top" align="left"><p>
The variable in the <span class="strong"><strong>update rule</strong></span> must be previously defined
in a <a href="def_LetRule.html" title="4.3.5.&nbsp;Let Rule">let rule</a>, <a href="def_ForallRule.html" title="4.3.7.&nbsp;Forall Rule">forall rule</a>,
<a href="def_ChooseRule.html" title="4.3.6.&nbsp;Choose Rule">choose rule</a>, or in a <a href="def_FormalParameter.html" title="5.8.1.&nbsp;Formal Parameters">formal parameter list</a>.
otherwise a compile-time error occurs.
</p><p>
The same restriction applies for the <a href="def_AsmFunctionLocation.html" title="5.5.3.&nbsp;ASM Function Location">ASM function location</a>: the referred
ASM function must be already defined in one of the loaded machines otherwise a compile-time error occurs.
Initialization of the corresponding ASM function is always given at the defining transformation module.
</p></td></tr></table></div><div class="highlights"><a name="def_UpdateRule_DefinedIn"></a><p><b>Defined In:&nbsp;</b>
<a href="def_SimpleRule.html" title="4.2.1.&nbsp;Simple Rule">simple rule</a>
</p></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="def_FailRule.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="sec_ASMSimpleRules.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="def_PrintRule.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">4.2.4.&nbsp;Fail Rule&nbsp;</td><td align="center" width="20%"><a accesskey="h" href="index.html">Home</a></td><td valign="top" align="right" width="40%">&nbsp;4.2.6.&nbsp;Print Rule</td></tr></table></div></body></html>