in reply to Re^3: Parsing and converting Fortran expression
in thread Parsing and converting Fortran expression [solved]
f2c seems to make all sorts of assumptions about variables, functions and expected output, many of which turn out to be wrong (e.g. by default, it interprets the statement "a = foo(1,2)" as if foo were a function, so it turns that into "a = foo_(&c__1, &c__2)"
I've used Fortran exactly twice, for "hello world" class programs, and that was about 20 years ago. But I think this is how Fortran actually works. If there is no matching array in the current scope, it must be a function call. And so on.
What is the context in which you need to parse / translate Fortran expressions? I.e. what problem are you actually trying to solve? My guess is that Fortran expressions should be quite rare outside a Fortran program, hence f2c.
"The program f2c is a horror, based on ancient code and hacked unmercifully. Users are only supposed to look at its C output, not at its appalling inner workings."
How desperate are you? Real world old code almost always looks ugly and has been hacked into a state where at least parts of it "just works, probably by pure magic". f2c looks quite small, so it should not be that hard to find and understand the relevant parts.
Alexander
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Parsing and converting Fortran expression
by kikuchiyo (Hermit) on Aug 26, 2015 at 19:02 UTC |