Link to home
Create AccountLog in
Avatar of lanzone
lanzoneFlag for United States of America

asked on

fortran to javascript conversion

Hello,

I have an old fortran program that does a bunch of calculations based on 10 input variables.  there are many DO loops and IF statements through out the source code.

is there a program out there or service anyone has used to convert the code from fortran to javascript.  

the ultimate goal is to turn this old dos program into a web interface since it is just calculations and nothing else.
Avatar of HonorGod
HonorGod
Flag of United States of America image

I seriously doubt it.

Most of the stuff I could find would "convert" fortran to something like HTML for a pretty (e.g., color hilighted) display.
If it is just if and do's let's hve a look.
I do not know fortran at all, but I have been in IT since 1986 so I do know if and do ;)
@mplungjan - Michel, oh yeah.  Fortran has been around for a long time, and a huge number of "improvements" have been made over that time.

It has been ages since I last programmed in Fortran, but even then it was a non-trivial language.
Yeah, I just had a look at http://en.wikipedia.org/wiki/Fortran

Yikes. Fortran 1957-2003
Avatar of Proculopsis
Proculopsis


There are a few Fortran grammars available for antlr which supports JavaScript targets.

SOLUTION
Avatar of dcesari
dcesari
Flag of Italy image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
That was my suggestion, dcesari :)
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of lanzone

ASKER

looking at Antlr now and trying to figure it out.
Avatar of lanzone

ASKER

i'm having no luck with the conversion.. it might just be too old of FORTRAN code to work with..


How about posting the Fortran, a decent editor macro might be able to bash it into shape.

Avatar of lanzone

ASKER

see attachment for the fortran program

had to rename it as a txt file, but it's called   cell1.for
 CELL1.txt
Holy *%ç&

Is the READ from file or a user input?
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Is
    float stc[], cvolt[], lsp[];
valid javascript? If so, what version?

I see this page https://developer.mozilla.org/en/JavaScript_typed_arrays

Well, you are right, it should be

var  stc=[], cvolt=[], lsp=[];

I did not mean to use these arraybuffer extensions you are indicating. Since these fortran arrays are not very big, I think it is reasonable to use standard js arrays (lists) for them.

As I said it is just a first guess out of my editor, no testing, so there may be many errors, it is not a definite solution.
Avatar of lanzone

ASKER

thanks for all of the help.  this is a good base to see where I need to get it from here..  

If you or anyone could program the rest of this, please contact me and let me know a price for the project.

thank you guys !
Thanks, please see my profile on EE for contacting me on more specific Fortran matters.