Maple Professionel
Maple Académique
Maple Edition Étudiant
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professionel
MapleSim Académique
Maple T.A. - Suite d'examens de classement
Maple T.A. MAA Placement Test Suite
Möbius - Didacticiels de mathématiques en ligne
Machine Design / Industrial Automation
Aéronautique
Ingénierie des véhicules
Robotics
Energie
System Simulation and Analysis
Model development for HIL
Modélisation du procédé pour la conception de systèmes de contrôle
Robotics/Motion Control/Mechatronics
Other Application Areas
Enseignement des mathématiques
Enseignement de l’ingénierie
Enseignement secondaire et supérieur (CPGE, BTS)
Tests et évaluations
Etudiants
Modélisation financière
Recherche opérationnelle
Calcul haute performance
Physique
Webinaires en direct
Webinaires enregistrés
Agenda des évènements
Forum MaplePrimes
Blog Maplesoft
Membres Maplesoft
Maple Ambassador Program
MapleCloud
Livres blancs techniques
Bulletin électronique
Livres Maple
Math Matters
Portail des applications
Galerie de modèles MapleSim
Cas d'Etudes Utilisateur
Exploring Engineering Fundamentals
Concepts d’enseignement avec Maple
Centre d’accueil utilisateur Maplesoft
Centre de ressources pour enseignants
Centre d’assistance aux étudiants
Printer Modules
Description
A Printer module encodes the instructions necessary to print intermediate code to a specific programming language.
As used above, the term printing refers to the process of translating intermediate code into a string which encodes the equivalent commands in some specific programming language.
Every translator has an associated Printer module. In particular, each language definition module must have an export named Printer, which corresponds to a Printer module.
Essentially, for each name nm in CodeGeneration:-Names, a Printer supplies a Print Handler, which is responsible for ``printing'' (i.e. translating) any subexpression of the Intermediate Code structure that has nm as its zeroth operand.
Creating a Printer module
To create a new, generic Printer module, you can call CodeGeneration[LanguageDefinition][DefaultPrinter]().
It is frequently desirable, however, to use the Printer module from some existing language definition. This is particularly useful when ``extending'' an existing translator, or when the many but not all of the details of translation for the new language are identical to those of an existing one. To make a copy of the Printer module for language name langname, you can call CodeGeneration[LanguageDefinition][Get](langname):-Printer.
Customizing a Printer module
Once obtained, a Printer module can be transformed and customized by calling its package functions. The following table lists the package functions of a Printer module.
AddFunction
AddFunctions
AddLibrary
AddOperator
AddPrintHandler
AddType
ApplyLanguageAttribute
Comment
Endline
GetExpressionType
GetFunction
GetFunctionSignature
GetIncludes
GetLanguageAttribute
GetOperator
GetPrecedence
GetPrintHandler
GetScopeName
GetScopeStructure
GetType
Indent
PopIndentation
Print
PrintBinary
PrintDelimitedList
PrintParentheses
PrintStatementBlock
PrintTarget
PrintUnary
PushIndentation
SetLanguageAttribute
SetPrecedence
For examples of creating and customizing a Printer module, see DefaultPrinter, or Get.
See Also
DefaultPrinter, Get, LanguageModule, Print
Download Help Document
Copyright © MathResources Inc. All Rights Reserved.
www.mathresources.com