All Projects → CalvinNeo → CFortranTranslator

CalvinNeo / CFortranTranslator

Licence: GPL-2.0 license
A translator from Fortran to C++. We provide statement-wise translation to improve readability.

Programming Languages

C++
36643 projects - #6 most used programming language
Yacc
648 projects
Lex
420 projects
Makefile
30231 projects
c
50402 projects - #5 most used programming language
CMake
9771 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to CFortranTranslator

Typescripttolua
Typescript to lua transpiler. https://typescripttolua.github.io/
Stars: ✭ 783 (+866.67%)
Mutual labels:  converter, transpiler
py midicsv
A Python port and library-fication of the midicsv tool by John Walker. If you need to convert MIDI files to human-readable text files and back, this is the library for you.
Stars: ✭ 55 (-32.1%)
Mutual labels:  converter
ics-to-json
📅 Convert ICS calendars (eg. Google Calendar) to an opinionated JSON format.
Stars: ✭ 36 (-55.56%)
Mutual labels:  converter
BlocksConverter
A PocketMine-MP plugin allows you to convert Minecraft PC maps to MCPE/Bedrock maps or vice-versa.
Stars: ✭ 47 (-41.98%)
Mutual labels:  converter
gpx-converter
python package for manipulating gpx files and easily converting gpx to other different formats
Stars: ✭ 54 (-33.33%)
Mutual labels:  converter
webfx
A JavaFX application transpiler. Write your Web Application in JavaFX and WebFX will transpile it in pure JS.
Stars: ✭ 210 (+159.26%)
Mutual labels:  transpiler
ZPL-Printer-Emulator-SDK
Convert, Preview & Render raw ZPL commands to PNG, JPG & PDF from .NET
Stars: ✭ 29 (-64.2%)
Mutual labels:  converter
ytdx
Download audio from YouTube videos
Stars: ✭ 55 (-32.1%)
Mutual labels:  converter
a2mp3
convert (nearly) every type of (audio)file to mp3 in a quick, easy, batch-enabled way!
Stars: ✭ 43 (-46.91%)
Mutual labels:  converter
node-poppler
Asynchronous node.js wrapper for the Poppler PDF rendering library
Stars: ✭ 97 (+19.75%)
Mutual labels:  converter
vista2xp
Vista-to-XP application converter
Stars: ✭ 36 (-55.56%)
Mutual labels:  converter
SoxSharp
.NET wrapper for SoX.
Stars: ✭ 41 (-49.38%)
Mutual labels:  converter
zxtap-to-wav
Converter of .TAP files (a ZX-Spectrum emulator data format) into .WAV sound files
Stars: ✭ 34 (-58.02%)
Mutual labels:  converter
vectorexpress-api
Vector Express is a free service and API for converting, analyzing and processing vector files.
Stars: ✭ 66 (-18.52%)
Mutual labels:  converter
osm-parquetizer
A converter for the OSM PBFs to Parquet files
Stars: ✭ 71 (-12.35%)
Mutual labels:  converter
System.Configuration.Abstractions
Injectable, mockable, extensible, configuration for .NET
Stars: ✭ 42 (-48.15%)
Mutual labels:  converter
gonvert
Golang character encoding converter with an automatic code-estimation.
Stars: ✭ 24 (-70.37%)
Mutual labels:  converter
brkraw
BrkRaw: A comprehensive tool to access raw Bruker Biospin MRI data
Stars: ✭ 31 (-61.73%)
Mutual labels:  converter
bfpile
Optimizing Brainfuck compiler, transpiler and interpreter
Stars: ✭ 19 (-76.54%)
Mutual labels:  transpiler
phptojs
PHP-to-JavaScript transpiler
Stars: ✭ 29 (-64.2%)
Mutual labels:  transpiler

CFortranTranslator

A translator from Fortran90/Fortran77(ISO/IEC 1539:1991) to C++

Fortran is an efficient tool in scientific calculation. However sometimes translating old fortran codes to C++ will enable more programming abstraction, better GUI framework support, higher performance IDE and easier interaction.

This translator is not intended to improve existing codes, but to make convenience for those who need features of C++ and remain fortran traits and performance as much as possible.

Build Status Coverage Status

Features

  1. Convert Fortran90/Fortran77 code to C++14

  2. Parse codes mixed with fixed form and free form automaticlly

  3. C++ implemetation of some Fortran's type and functions

  4. Generated C++ code remains abstract level of the origin code

    e.g. implied-do will not expand to a for-loop directly, but to a ImpliedDo struct

License

The whole project, including both the translator itself and fortran standrad library implementation is distributed under GNU GENERAL PUBLIC LICENSE Version 2

                    GNU GENERAL PUBLIC LICENSE
                       Version 2, June 1991

Calvin Neo
Copyright (C) 2016  Calvin Neo

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

Install

Build project in Windows

Dependencies

  1. MSVC(e.g. Visual Studio 2015)
  2. win_flex(win_flex_bison 2.4.5, flex 2.5.37)
  3. win_bison(win_flex_bison 2.4.5, bison 2.7)
  4. boost(1.60)

Configure boost

  • build boost
bjam --toolset=msvc-14.0 address-model=64
  • configure boost
    1. Add boost_dir directory to additional include library
    2. Add boost_dir/libs and boost_dir/stage/lib to additional library directory

Configure winflex and winbison

  1. On the Project menu, choose Project Dependencies.
  2. Select Custom Build Tools
  3. Add /src/grammar/custom_build_rules/win_flex_bison_custom_build.props

Build by MSBuild

Run /build/vcbuild.cmd

You can get Visual C++ Build Tools here(Not available now) or here

All built production will be in /bin

Build by NMake

Run /build/winmake.cmd to get a x64 Release binary

Build By Visual Studio

Open /vsbuild/CFortranTranslator.sln

Build project in Ubuntu

Dependencies

  1. g++(e.g. g++ 5.4.0)
  2. bison
  3. boost

Configure boost

Install boost by

sudo apt-get install libboost-all-dev

Configure bison

Install bison by

sudo apt-get install bison

Make

cd build && make
make install

Fortran standard library(for90std)

for90std is a simple implementation of fortran's library and is yet to be done

for90std requires compiler support at least C++14 standard(with several C++17 std functions)

With the following statement to include for90std module

#include "for90std/for90std.h"

cpptest

cpptest is a C++ project template for you to test for90std.

Run CFortranTranslator with arguments

-f file_name : translate file_name into C++
    **Currently, Unicode encoding is not supported**
-d : use debug mode
-C : use c-style array
-F 90/77 : specify Fortran standard, by default the translator accept a mixed Fortran77/90 codes

Demo

The "hello world" demo

  1. Use the following command to generate target C++ code
    CFortranTranslator.exe -Ff demos/helloworld.f90 > target.cpp
    
  2. Build target.cpp, modify #include "../for90std/for90std.h" to ensure you include the right path of for90std library. You can either use /cpptest/winmake.cmd to build your code, or build them in cpptest project.

More demos

Translator Demos

Several demos are provided in /demos. Run /demos/merge_test.py to generate a *.form.test file by merging codes from all .for/.f90 files in a certain folder. Then you can convert the merged Fortran code into C++.

for90std Demos

Several demos are provided in /demos/for90std. Make sure you have google-test library before test.

Debug

Only fatal errors hindering parsing will be reported by translator.

Debuging origin fortran code or generated C++ code is recommended.

Docs

see /docs/brief.md

Develop details guide

see /docs/Develop.md to have an general understanding of implementation of this project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].