add translation for operator - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Code Generation Package : Language Definition : Printer : CodeGeneration/LanguageDefinition/Printer/AddOperator

Printer:-AddOperator - add translation for operator

Printer:-GetOperator - get translation for operator

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


Download Help Document

Copyright © MathResources Inc. All Rights Reserved.

www.mathresources.com

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam