| Version 2 (modified by , 7 years ago) ( diff ) |
|---|
Supported Subset of Fortran Language
Program Units
PROGRAMprogram-name
and
END[PROGRAM[program-name]](R1101 -- 1103)
MODULEmodule-name
and
END[MODULE[module-name]](R1104 -- 1106)
BLOCK DATA[block-data-name]
and
END[BLOCK DATA[block-data-name]]
SUBROUTINEFUNCTION- Labels
Types
REALDOUBLE PRECISIONINTEGERCHARACTERLOGICALIMPLICITNONE(TODO: Implement the check, when it is used.)
Expressions
(array sections)
Statements
USEmodule-name [, rename-list]
or
USEmodule-name ,ONLY: [ only-list ](R1107 -- 1109)
CALL
DO(struct)END DODO WHILEEXITCONTINUEIF(struct)THENELSEGOTO& computedGOTO
Fortran Transformations
Here are all transformations converting Fortran program behaviors to CIVL-C ones.
1 Program Unit
1.1 Program Entry
-
PROGRAMindicates the entry of the whole program.
A 'PROGRAM' chunk is transformed to be the main function in CIVL-C.
1.2 Subroutines & Call Statements
SUBROUTINEis a set of program instructions that process given arguments.
A 'SUBROUTINE' chunk is transformed as a CIVL-C function with
voidtype; All parameters with scalar types will be transformed as passed-by-reference.
- 'SUBROUTINE' chunks are triggered by
CALLkeyword.
A CALL-statement is transformed as a normal function call without a return-value. Argument variables with scalar types are transformed as an address-of expression.
(Same procedures should be applied on any other non-array type arguments, like structs.)
(If non-array argument variables are declared as passed-by-value, there should be no change.)
(An array argument variable will be handled by 'array-lambda', an array-type argument declared as value)
([ONLT TRUE FOR NON MULTI-THREAD PROGRAMS] Analysis to determine whether parameters could be modified in the coerce of the call; If a parameter is proved to be never modified then it can be transformed as it self.)
1.3 Functions & Function Returned Values
2 Statements
2.1 Control Statements
IF-ELSEIF-ELSEstructure keeps unchanged.
DOloops are transformed asforloops in CIVL-C.
(TODO: Fix the bound issue on the loop variable, which goes beyond the bound in C but stops on the bound in Fortran.)
- Computed
GOTOstructures are transformed asswitch-casestructure in CIVL.
