Overview of the LanguageDefinition Subpackage
Necessary Steps for Defining a Language
List of CodeGeneration[LanguageDefinition] Commands
Sample Source Code
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.
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.
The following is a list of available commands in the CodeGeneration[LanguageDefinition] subpackage.
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.
Download Help Document
What kind of issue would you like to report? (Optional)