Overview of the LanguageDefinition Subpackage - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Code Generation Package : Language Definition : CodeGeneration/General/LanguageDefinitionOverview

Overview of the LanguageDefinition Subpackage

 

Calling Sequence

Description

Necessary Steps for Defining a Language

List of CodeGeneration[LanguageDefinition] Commands

Sample Source Code

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

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam