blob: eaee44de1d2b425f015e0ffe6ff41e170d192930 [file] [log] [blame]
<html><head><META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>4.1.1.&nbsp;ASM Rule Definition</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_DefASMRule.html" title="4.1.&nbsp;ASM Rule Definition and Invocation"><link rel="prev" href="sec_DefASMRule.html" title="4.1.&nbsp;ASM Rule Definition and Invocation"><link rel="next" href="def_AsmRuleInvoc.html" title="4.1.2.&nbsp;ASM Rule Invocation"></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.1.1.&nbsp;ASM Rule Definition</th></tr><tr><td align="left" width="20%"><a accesskey="p" href="sec_DefASMRule.html">Prev</a>&nbsp;</td><th align="center" width="60%">4.1.&nbsp;ASM Rule Definition and Invocation</th><td align="right" width="20%">&nbsp;<a accesskey="n" href="def_AsmRuleInvoc.html">Next</a></td></tr></table><hr></div><div class="sect3" lang="en"><div class="titlepage"><div><div><h4 class="title"><a name="def_AsmRuleDef"></a>4.1.1.&nbsp;ASM Rule Definition</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_AsmRuleDef_Description"></a>Description</th></tr><tr><td valign="top" align="left"><p>
An <span class="strong"><strong>ASM rule definition</strong></span><a name="N11131" class="indexterm"></a>
is the building block of an ASM program. When invoked, its formal parameters are substituted with actual parameters, and its body is called.
</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_AsmRuleDef_Syntax"></a>Syntax</th></tr><tr><td valign="top" align="left"><pre class="programlisting">
AsmRuleDefAST ::= <a href="def_Annotation.html" title="1.2.2.&nbsp;Annotation">OptAnnotationsAST</a> <span class="token">rule</span> <a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">TypeNameAST</a> DirectedFormalParameterDefAST <span class="token">=</span> <a href="def_AsmRuleInvoc.html" title="4.1.2.&nbsp;ASM Rule Invocation">AsmRuleInvocAST</a>
DirectedFormalParameterDefAST ::= <span class="token">(</span> <a href="def_FormalParameter.html" title="5.8.1.&nbsp;Formal Parameters">FormalParamsAST</a> <span class="token">)</span>
| <span class="token">(</span> <span class="token">)</span>
</pre><p>
An <span class="strong"><strong>ASM rule definition</strong></span> is identified by a <a href="def_ModelElementName.html" title="5.7.1.&nbsp;Model Element Name">name</a>,
it has a <a href="def_DirectedFormalParameter.html" title="5.8.2.&nbsp;Directed Formal Parameters">list of directed formal parameters</a>, and an
<a href="def_AsmRuleInvoc.html" title="4.1.2.&nbsp;ASM Rule Invocation">ASM rule invocation</a> as body.
</p></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_AsmRuleDef_Semantics"></a>Semantics</th></tr><tr><td valign="top" align="left"><p>
An <span class="strong"><strong>ASM rule definition</strong></span> can be invoked by a
<a href="def_CallRule.html" title="4.2.2.&nbsp;Call Rule">call rule</a>. When invoked, the formal parameters are substituted
by the actual parameters of the call, and the <a href="def_AsmRuleInvoc.html" title="4.1.2.&nbsp;ASM Rule Invocation">body</a> of the ASM rule is called.
</p><p>
The entry point of an ASM program is a special user-defined rule called <span class="emphasis"><em>main</em></span>.
</p><p>
Two rules may have identical names as long as their arity (the number of parameters) is different.
</p></td></tr></table></div><div class="highlights"><a name="def_AsmRuleDef_Remark"></a><p><b>Remark.&nbsp;</b>
If the <span class="emphasis"><em>main</em></span>rule of a machine has an input parameter then this parameter can
set by the user when the transformation starts execution. The actual values
of the input parameters should be defined in the pop-up window separated by
spaces (' '). Currently, each input parameter is considered to be a string.
Most frequently, the <span class="strong"><strong>body</strong></span> of an ASM rule definition
is a <a href="def_SequentialRule.html" title="4.3.2.&nbsp;Sequential Rule">sequential rule</a>, but it can be arbitrary
<a href="def_AsmRuleInvoc.html" title="4.1.2.&nbsp;ASM Rule Invocation">ASM rule invocations</a>.
</p></div><div class="highlights"><a name="def_AsmRuleDef_DefinedIn"></a><p><b>Defined In:&nbsp;</b>
<a href="def_Machine.html" title="1.2.1.&nbsp;GTASM Machine Definition">machine</a>
</p></div></div><div class="navfooter"><hr><table summary="Navigation footer" width="100%"><tr><td align="left" width="40%"><a accesskey="p" href="sec_DefASMRule.html">Prev</a>&nbsp;</td><td align="center" width="20%"><a accesskey="u" href="sec_DefASMRule.html">Up</a></td><td align="right" width="40%">&nbsp;<a accesskey="n" href="def_AsmRuleInvoc.html">Next</a></td></tr><tr><td valign="top" align="left" width="40%">4.1.&nbsp;ASM Rule Definition and Invocation&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.1.2.&nbsp;ASM Rule Invocation</td></tr></table></div></body></html>