get generic printing module - Maple Help

Online Help

All Products    Maple    MapleSim


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

CodeGeneration[LanguageDefinition][DefaultPrinter] - get generic printing module

Calling Sequence

CodeGeneration[LanguageDefinition][DefaultPrinter]()

Description

• 

The DefaultPrinter command returns a Printer module which you can use when implementing a CodeGeneration translator.  You can override the defaults in this Printer module to provide custom translations for code represented in the Intermediate Code structure.

Examples

withCodeGeneration:

moddef := proc() module()
   export Printer, PrintTarget;
        Printer := LanguageDefinition:-DefaultPrinter();
        PrintTarget := proc() Printer:-PrintTarget(args); end proc:

        Printer:-AddFunction("cos", [numeric]::numeric, "MyCosine");
        Printer:-AddOperator(Names:-Assignment = "assigned to");
        Printer:-AddOperator(Names:-Addition   = "plus");
end module end proc:

LanguageDefinitionAddDefaultPrinterExample,moddef

Translatex=y+3,language=DefaultPrinterExample

x assigned to y plus 3;

See Also

CodeGeneration, CodeGenerationDetails, IntermediateCodeStructure


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