Overview of the CodeGeneration Package - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Packages : CodeGeneration

Overview of the CodeGeneration Package

Basic Functionality

Description

• 

The CodeGeneration package is a collection of commands and subpackages that enable the translation of Maple code to other programming languages.

Output

• 

Translated source code in the target language.

Code Generation Assistant

• 

You can generate code using an interactive template with the Code Generation Assistant.

Accessing CodeGeneration Package Commands

• 

Each command in the CodeGeneration package can be accessed by using the long form or the short form of the command in the command calling sequence.

  

Long form

CodeGeneration[C]([[x, 2*y], [5, z]]);

  

Short form

with(CodeGeneration);

C([[x, 2*y], [5, z]]);

Essential CodeGeneration Package Commands

C

translate Maple code to C code

CSharp

translate Maple code to C# code

Fortran

translate Maple code to Fortran code

Java

translate Maple code to Java code

JavaScript

translate Maple code to JavaScript code

Matlab

translate Maple code to MATLAB(R) code

Perl

translate Maple code to Perl code

Python

translate Maple code to Python code

R

translate Maple code to R code

VisualBasic

translate Maple code to VisualBasic code

Examples

withCodeGeneration

C,CSharp,Fortran,IntermediateCode,Java,JavaScript,LanguageDefinition,Matlab,Names,Perl,Python,R,Save,Translate,VisualBasic

(1)

Generate C code

Cx+y+z2xz

cg = -2 * x * z + x + y + z;

Generate MATLAB® code

Matlabx,2y+z,xy,z

cg0 = [x 2 * y + z; x * y z;];

Generate Visual Basic code

VisualBasics=1.0+x,t=lnsⅇx,r=ⅇx+xt

s = 0.10E1 + x
t = Log(s) * Exp(-x)
r = Exp(-x) + x * t

Details

  

For more information including:

• 

options available to alter the translated output

• 

extending the CodeGeneration package using the LanguageDefinition subpackage

  

see the Details of the CodeGeneration Package help page.

See Also

CodeGeneration Example Worksheet, Matlab


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