Menu ▾ ▴

#813 fortran function prints user-defined operators as such

None
open
nobody
5
2025-10-21
2005-11-16
No

The fortran function prints user-defined operators as such, but probably should print them using ordinary function notation (i.e., function name then arguments in parentheses) since Fortran doesn't admit new operators.

prefix ("foo");
infix ("bar");
postfix ("baz");
nofix ("quux");
matchfix ("blurfle", "blart");
nary ("mumble");

fortran (foo a + b bar c + d baz + quux + blurfle e, f, g blart + h mumble j mumble k);

=>

h mumble j mumble k+blurflee,f,gblart+d baz+b bar
c+foo a+quux

should probably be

mumble(h, j, k) + blurfle(e, f, g) + baz(d) + bar(b, c) + foo(a) + quux()

I don't know how hard we should try to fix this. Maybe gentran (in share/) already handles this.

Discussion

  • Robert Dodier

    Robert Dodier - 2025-10-21

    For the record, f90 also prints the same incorrect output.

    gentran handles it mostly correctly, although the nofix operator above should be output as quux() instead of just quux; the other operators (prefix, infix, matchfix, postfix, and nary) are all OK.

     
  • Robert Dodier

    Robert Dodier - 2025-10-21
    • labels: fortran, formatting --> fortran, formatting, f90, gentran
     

Log in to post a comment.