Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Overview of the LanguageDefinition Subpackage
Calling Sequence
LanguageDefinition[command](arguments)
command(arguments)
Description
With the LanguageDefinition subpackage, you can enable CodeGeneration to perform translations to new, user-defined languages.
The Translate command translates Maple code to any specified language currently recognized by CodeGeneration. A language is recognized if it is one of the pre-defined languages supported by CodeGeneration, or if it has been defined for use by CodeGeneration with Add or Define.
Code translation in the CodeGeneration package operates by first translating Maple input to a intermediate structure . This is followed by the printing phase, in which the work of translation to the new language is done. During this phase, the intermediate form is traversed, and at each node in the expression tree, a language-specific print handler procedure is called, which is responsible for issuing the necessary statements to translate a given subexpression of the intermediate form into a string.
Necessary Steps for Defining a Language
There are two distinct methods by which you can enable CodeGeneration to perform translations from Maple to a new target language.
Create a language module. You can create a language module by extending an existing language module or defining a new module. For information, see Language Definition Module. Once created, add this module to the set of languages recognized by CodeGeneration with the Add command.
Define the language with Define.
Once you have defined the language by either of these methods, you can perform translations to the new language using Translate.
To save your language definition in order to make it available for use in later sessions, use the Save command.
List of CodeGeneration[LanguageDefinition] Commands
The following is a list of available commands in the CodeGeneration[LanguageDefinition] subpackage.
Add
DefaultPrinter
Define
GenericPrinter
Get
IsDefined
ListLanguages
Sample Source Code
Sample source code associated with each of the built-in translators is located in the samples\\CodeGeneration directory of your Maple installation. These examples of large scale language translators are provided as a reference for users seeking to write custom translators.
See Also
CodeGeneration, LanguageModule, Translate
Download Help Document