{"title":"Mc2FOR demo: A tool for automatically translating MATLAB to FORTRAN 95","authors":"Xu Li, L. Hendren","doi":"10.1109/CSMR-WCRE.2014.6747218","DOIUrl":null,"url":null,"abstract":"MATLAB is a dynamic numerical scripting language widely used by scientists, engineers and students. While MATLAB'S high-level syntax and dynamic types makes it ideal for prototyping, programmers often prefer using high-performance static languages such as FORTRAN for their final distributable code. Rather than requiring programmers to rewrite their code by hand, our solution is to provide a tool that automatically translates the original MATLAB program to an equivalent FORTRAN program. There are several important challenges for automatically translating MATLAB to FORTRAN, such as correctly estimating the static type characteristics of all the variables in a MATLAB program, mapping MATLAB built-in functions, and effectively mapping MATLAB constructs to FORTRAN constructs. In this tool demonstration, we introduce the tool Mc2FOR, a mature prototype which automatically translates MATLAB programs to FORTRAN. This tool takes as input a MATLAB entry point function file of a program with corresponding information of its input parameters, then automatically finds all functions reachable directly or indirectly from the entry point, loads the necessary files, and translates all the reachable MATLAB functions to equivalent FORTRAN. The output of the tool is a collection of FORTRAN function files, which can be compiled with any FORTRAN 95-compliant compiler. Mc2FOR is open source, and has been implemented in Java using the McLab framework, which means that the tool runs on any system supporting Java.","PeriodicalId":166271,"journal":{"name":"2014 Software Evolution Week - IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE)","volume":"1 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"1900-01-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"2","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2014 Software Evolution Week - IEEE Conference on Software Maintenance, Reengineering, and Reverse Engineering (CSMR-WCRE)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/CSMR-WCRE.2014.6747218","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 2
Abstract
MATLAB is a dynamic numerical scripting language widely used by scientists, engineers and students. While MATLAB'S high-level syntax and dynamic types makes it ideal for prototyping, programmers often prefer using high-performance static languages such as FORTRAN for their final distributable code. Rather than requiring programmers to rewrite their code by hand, our solution is to provide a tool that automatically translates the original MATLAB program to an equivalent FORTRAN program. There are several important challenges for automatically translating MATLAB to FORTRAN, such as correctly estimating the static type characteristics of all the variables in a MATLAB program, mapping MATLAB built-in functions, and effectively mapping MATLAB constructs to FORTRAN constructs. In this tool demonstration, we introduce the tool Mc2FOR, a mature prototype which automatically translates MATLAB programs to FORTRAN. This tool takes as input a MATLAB entry point function file of a program with corresponding information of its input parameters, then automatically finds all functions reachable directly or indirectly from the entry point, loads the necessary files, and translates all the reachable MATLAB functions to equivalent FORTRAN. The output of the tool is a collection of FORTRAN function files, which can be compiled with any FORTRAN 95-compliant compiler. Mc2FOR is open source, and has been implemented in Java using the McLab framework, which means that the tool runs on any system supporting Java.