Maple Professional
Maple Academic
Maple Student Edition
Maple Personal Edition
Maple Player
Maple Player for iPad
MapleSim Professional
MapleSim Academic
Maple T.A. - Testing & Assessment
Maple T.A. MAA Placement Test Suite
Möbius - Online Courseware
Machine Design / Industrial Automation
Aerospace
Vehicle Engineering
Robotics
Power Industries
System Simulation and Analysis
Model development for HIL
Plant Modeling for Control Design
Robotics/Motion Control/Mechatronics
Other Application Areas
Mathematics Education
Engineering Education
High Schools & Two-Year Colleges
Testing & Assessment
Students
Financial Modeling
Operations Research
High Performance Computing
Physics
Live Webinars
Recorded Webinars
Upcoming Events
MaplePrimes
Maplesoft Blog
Maplesoft Membership
Maple Ambassador Program
MapleCloud
Technical Whitepapers
E-Mail Newsletters
Maple Books
Math Matters
Application Center
MapleSim Model Gallery
User Case Studies
Exploring Engineering Fundamentals
Teaching Concepts with Maple
Maplesoft Welcome Center
Teacher Resource Center
Student Help Center
Language Definition Module
Description
A language definition module is a repository of information necessary for translating intermediate code to a specific target language.
Language Module Exports
A language definition module is a Maple module with the exports PrintTarget, and Printer. These exports must satisfy certain criteria:
Printer - a valid Printer module.
PrintTarget - a procedure that returns a string, the translated output. In most cases, PrintTarget simply calls Printer:-PrintTarget.
Additional Notes
For Add to work correctly, you must use single-quotes to delay the evaluation of your language module before adding it with Add. In other words, your module must be of the form 'module() ... end module', and must evaluate to a module definition, not a module. For more information on module definitions, see type,moduledefinition.
The body of the module definition must contain a sequence of calls to Printer commands that define language-specific data, as well as any utility procedures.
Once defined, the module definition must be added to CodeGeneration using the Add command.
Examples
m := 'module() export PrintTarget, Printer; PrintTarget := proc() Printer:-PrintTarget(args); end proc: Printer := eval(LanguageDefinition[Get]("default")):-Printer; Printer:-AddFunction("sin", [numeric]::numeric, "sine"); Printer:-AddOperator(Names:-Assignment = "="); end module':
t0 = sine(x);
See Also
Add, Define, Get, Printer
Download Help Document
Copyright © MathResources Inc. All Rights Reserved.
www.mathresources.com