Overview of the CodeGeneration Package
Basic Functionality
Accessing CodeGeneration Package Commands
Essential CodeGeneration Package Commands
Examples
Details
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.
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]]);
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
Julia
translate Maple code to Julia 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
Swift
translate Maple code to Swift code
VisualBasic
translate Maple code to VisualBasic code
with⁡CodeGeneration
C,CSharp,Fortran,IntermediateCode,Java,JavaScript,Julia,LanguageDefinition,Matlab,Names,Perl,Python,R,Save,Swift,Translate,VisualBasic
Generate C code
C⁡x+y+z−2⁢x⁢z
cg = -2 * x * z + x + y + z;
Generate MATLAB® code
Matlab⁡x,2⁢y+z,x⁢y,z
cg0 = [x 2 * y + z; x * y z;];
Generate Visual Basic code
VisualBasic⁡s=1.0+x,t=ln⁡s⁢exp⁡−x,r=exp⁡−x+x⁢t
s = 0.10E1 + x t = Log(s) * Exp(-x) r = Exp(-x) + x * t
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
Download Help Document