Intermediate Code Names - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Code Generation Package : Intermediate Code Names

Intermediate Code Names

• 

The basic structure on which both built-in and user-created language definitions operate is the intermediate form, an expression tree made of nested function calls representing a simplified form of the Maple input.

• 

For a detailed listing of the members of the CodeGeneration:-Names subpackage and their function within the intermediate form, see Intermediate Code Structure.

• 

The names of the functions in the intermediate form are members of the Names subpackage of the CodeGeneration package.  When writing a language definition module, it is frequently necessary to refer to these names, and is therefore often useful to use the use statement with the CodeGeneration:-Names subpackage.

Examples

> 

useCodeGeneration:-NamesinCodeGenerationLanguageDefinitionDefine⁡SomeLanguage,extend=default,AddOperator⁡Assignment=:=,AddPrintHandler⁡Integer=x→Printer:-Print⁡convert⁡x,'string'end use:

> 

CodeGenerationTranslate⁡x=2,language=SomeLanguage

x := 2;

> 

CodeGenerationLanguageDefinitionDefine⁡SomeOtherLanguage,extend=SomeLanguage,AddFunction⁡GAMMA,numeric::numeric,gamma,AddFunction⁡GAMMA,integer::numeric,gamma,AddFunction⁡factorial,integer::numeric,x→Printer:-Print⁡CodeGeneration:-Names:-Sum⁡CodeGeneration:-Names:-FunctionCall⁡Name⁡GAMMA,CodeGeneration:-Names:-ExpressionSequence⁡x,integer::numeric,CodeGeneration:-Names:-Integer⁡1:

> 

CodeGenerationTranslate⁡n!,language=SomeOtherLanguage

cg := gamma(n) + 1;

See Also

Intermediate Code

Intermediate Code Structure