AddOperator - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Printer

  

AddOperator

  

add translation for operator

  

GetOperator

  

get translation for operator

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

Printer:-AddOperator(operatorname = translation)

Printer:-GetOperator(operatorname)

Parameters

Printer

-

Printer module

operatorname

-

name; operator supported by CodeGeneration

translation

-

string; equivalent of operator in target language

Description

• 

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.

Examples

Define a language that resembles C, but uses . for multiplication.

withCodeGeneration:

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

Printer