Printer
AddOperator
add translation for operator
GetOperator
get translation for operator
Calling Sequence
Parameters
Description
Examples
Printer:-AddOperator(operatorname = translation)
Printer:-GetOperator(operatorname)
-
Printer module
operatorname
name; operator supported by CodeGeneration
translation
string; equivalent of operator in target language
The AddOperator command defines a string representing the a prefix unary or infix binary operator in a Printer module corresponding to a target language.
The operatorname parameter can be one of the following members of CodeGeneration:-Names: And, Not, Or, Equal, Less, LessEqual, NotEqual, Power, Product, Sum, Inverse, Negation, Exponentiation, Multiplication, Addition, Subtraction, Division, Assignment.
The GetOperator command returns the string representing the target language equivalent for operatorname.
Define a language that resembles C, but uses . for multiplication.
with⁡CodeGeneration:
LanguageDefinition[Define]( "C_with_dot", extend="C", AddOperator( Names:-Multiplication = "." ) ): p := proc(x,y) 2*x end proc: Translate(p, language="C_with_dot");
int p (int x, double y) { return(2 . x); }
See Also
Names
Download Help Document