CodeGeneration[LanguageDefinition]
DefaultPrinter
get generic printing module
Calling Sequence
Description
Examples
CodeGeneration[LanguageDefinition][DefaultPrinter]()
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.
with⁡CodeGeneration:
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:
LanguageDefinitionAdd⁡DefaultPrinterExample,moddef
Translate⁡x=y+3,language=DefaultPrinterExample
x assigned to y plus 3;
See Also
CodeGeneration
CodeGenerationDetails
IntermediateCodeStructure
Download Help Document