Difference between revisions of "VM for transfer"

From Apertium
Jump to navigation Jump to search
Line 18: Line 18:


== Sample Translation ==
== Sample Translation ==

<code>
<out>
<chunk name="det_det_nom_adj" case="caseFirstWord">
<tags>
<tag><lit-tag v="SN"/></tag>
<tag><var n="tipus_det"/></tag>
<tag><var n="gen_chunk"/></tag>
<tag><var n="nbr_chunk"/></tag>
</tags>
<lu>
<clip pos="1" side="tl" part="lem"/>
<clip pos="1" side="tl" part="a_det"/>
<clip pos="1" side="tl" part="gen_sense_mf" link-to="3"/>
<clip pos="1" side="tl" part="gen_mf"/>
<clip pos="1" side="tl" part="nbr_sense_sp" link-to="4"/>
<clip pos="1" side="tl" part="nbr_sp"/>
</lu>
<b/>
<lu>
<lit v="el"/>
<lit-tag v="det.def"/>
<clip pos="1" side="tl" part="gen_sense_mf" link-to="3"/>
<lit-tag v="pl"/>
</lu>
<b pos="1"/>
<lu>
<clip pos="3" side="tl" part="lemh"/>
<clip pos="3" side="tl" part="a_nom"/>
<clip pos="3" side="tl" part="gen_sense_mf" link-to="3"/>
<clip pos="3" side="tl" part="gen_mf"/>
<clip pos="3" side="tl" part="nbr_sense_sp" link-to="4"/>
<clip pos="3" side="tl" part="nbr_sp"/>
<clip pos="3" side="tl" part="lemq"/>
</lu>
<b/>
<b pos="2"/>
<lu>
<var n="adjectiu1"/>
<clip pos="2" side="tl" part="lemh"/>
<clip pos="2" side="tl" part="a_adj"/>
<clip pos="2" side="tl" part="gen_sense_mf" link-to="3"/>
<clip pos="2" side="tl" part="gen_mf"/>
<clip pos="2" side="tl" part="nbr_sense_sp" link-to="4"/>
<clip pos="2" side="tl" part="nbr_sp" link-to="4"/>
<clip pos="2" side="tl" part="lemq"/>
</lu>
</chunk>
</out>
</code>

Revision as of 03:53, 30 May 2010

Instruction Sets

Mnemonic Opcode
(in hex)
Other operands Stack
[before]→[after]
Description
push - value [empty] → value Pushes a value in the stack
jmp - N/A label → [empty] Jumps to the label
hlt - N/A Halts the program
return - N/A PC → [empty] Returns from a subroutine

Notes

  • None of the macro and actions need to return anything (unlike conventional functions), so provision for returning a value (using stack) is unnecessary

Sample Translation

       <out>
         <chunk name="det_det_nom_adj" case="caseFirstWord">
       <tags>
         <tag><lit-tag v="SN"/></tag>
         <tag></tag>
         <tag></tag>
         <tag></tag>
       </tags>
       <lu>
         <clip pos="1" side="tl" part="lem"/>
         <clip pos="1" side="tl" part="a_det"/>
         <clip pos="1" side="tl" part="gen_sense_mf" link-to="3"/>
         <clip pos="1" side="tl" part="gen_mf"/>
         <clip pos="1" side="tl" part="nbr_sense_sp" link-to="4"/>
         <clip pos="1" side="tl" part="nbr_sp"/>
       </lu>
       
       <lu>
         <lit v="el"/>
         <lit-tag v="det.def"/>
         <clip pos="1" side="tl" part="gen_sense_mf" link-to="3"/>
         <lit-tag v="pl"/>
       </lu>
       
       <lu>
         <clip pos="3" side="tl" part="lemh"/>
         <clip pos="3" side="tl" part="a_nom"/>
         <clip pos="3" side="tl" part="gen_sense_mf" link-to="3"/>
         <clip pos="3" side="tl" part="gen_mf"/>
         <clip pos="3" side="tl" part="nbr_sense_sp" link-to="4"/>
         <clip pos="3" side="tl" part="nbr_sp"/>
         <clip pos="3" side="tl" part="lemq"/>
       </lu>
       
       
       <lu>
         
         <clip pos="2" side="tl" part="lemh"/>
         <clip pos="2" side="tl" part="a_adj"/>
         <clip pos="2" side="tl" part="gen_sense_mf" link-to="3"/>
         <clip pos="2" side="tl" part="gen_mf"/>
         <clip pos="2" side="tl" part="nbr_sense_sp" link-to="4"/>
         <clip pos="2" side="tl" part="nbr_sp" link-to="4"/>
         <clip pos="2" side="tl" part="lemq"/>
       </lu>
         </chunk>
       </out>