User:Mlforcada/intermediatelanguagefortransfer

From Apertium
Jump to navigation Jump to search

The first 2 characters of the file are the length of the longest pattern and the number of rules.

Mnemonic Action
rule [int] marks the start of a new rule composed of the next [int] characters
drop drop the top of the stack
dup duplicate the top of the stack
string pushes the next [int] characters onto the stack as a literal string
jump [int] increments the instruction pointer by [int]
jumponfalse pops a bool off the stack, increments instruction pointer by [int] if its false
and pops two booleans off the stack and pushes whether all of them are true
or pops two Boolean off the stack and pushes whether any of them are true
not logically negates top of stack
equal pop two strings off the stack and push True if they are equal and False otherwise
equalfold pop two strings off the stack and push True if they are equal (regardless of case) and False otherwise
isprefix pop two strings off the stack and push a Boolean whether the first string popped is a prefix of the second
isprefixfold pop two strings off the stack and push a Boolean whether the first string popped is a prefix of the second (regardless of case)
issuffix pop two strings off the stack and push a Boolean whether the first string popped is a suffix of the second
issuffixfold pop two strings off the stack and push a Boolean whether the first string popped is a suffix of the second (regardless of case)
issubstring pop two strings off the stack and push a Boolean whether the first string popped is a substring of the second
issubstringfold pop two strings off the stack and push a Boolean whether the first string popped is a substring of the second (regardless of case)
begins with list push whether the second string popped begins with any member of the list named by the first string popped ([# ignores case)
] / ]# ends with list push whether the second string popped ends with any member of the list named by the first string popped (]# ignores case)
n / n# in push whether the second string popped is a member of the list named by the first (n# ignores case)
> begin let indicates that the next clip or var statement should not be evaluated
* / *# end let clip pops a value and an unevaluated clip and sets the clip to the value (*# copies the case of the value to the clip)
4 / 4# end let var pops a value and a variable name and sets the variable to the value (4# copies the case of the value to the variable)
< [int] out pops [int] chunks off the stack and appends them to the output queue in the order that they were pushed (in recursive mode, the output queue is later passed back to the rule applier)
. [int] clip if preceded by >, pushes [int] onto the stack, otherwise pops a string off the stack and retrieves that property of the position indicated by [int]
$ var if preceded by >, do nothing, otherwise pops a string off the stack and pushes the value of the variable with that name
getcase pops a string off the stack, pushes string "AA", "Aa", or "aa" depending on its case
applycase pops one string off the stack, and modifies the top of stack according to the case pattern of the string popped
concat pops two strings off the stack, concatenates them, and pushes the result
{ [int] chunk pops [int] items off the stack and puts them into a chunk (there are currently problems with this command)
pseudolemma pop a chunk off the stack and push its pseudolemma
blank push an integer n off the stack and push the n-th superblank onto the stack. If n is out of range (e.g. -1), push a blank containing a single space