= Supported Subset of Fortran Language = == Program Units == * `PROGRAM` ''program-name'' '''and''' `END`[`PROGRAM` [''program-name'']] (R1101 -- 1103) * `MODULE` ''module-name'' '''and''' `END`[`MODULE` [''module-name'']] (R1104 -- 1106) * `BLOCK DATA` [''block-data-name''] '''and''' `END` [`BLOCK DATA` [''block-data-name'']] * `SUBROUTINE` * `FUNCTION` * Labels == Types == * `REAL` `DOUBLE PRECISION` * `INTEGER` * `CHARACTER` * `LOGICAL` * `IMPLICIT` `NONE` (TODO: Implement the check, when it is used.) == Expressions == * `` (array sections) == Statements == * `USE` ''module-name'' [, ''rename-list''] '''or''' `USE` ''module-name'' , `ONLY` : [ ''only-list'' ] (R1107 -- 1109) * `CALL` * `DO` (struct) `END DO` * `DO WHILE` * `EXIT` * `CONTINUE` * `IF` (struct) `THEN` `ELSE` * `GOTO` & computed `GOTO` = Fortran Transformations = Here are all transformations converting Fortran program behaviors to CIVL-C ones. == 1 Program Unit == === 1.1 Program Entry === * `PROGRAM` indicates the entry of the whole program. A 'PROGRAM' chunk is transformed to be the main function in CIVL-C. === 1.2 Subroutines & Call Statements === * `SUBROUTINE` is a set of program instructions that process given arguments. A 'SUBROUTINE' chunk is transformed as a CIVL-C function with `void` type; All parameters with scalar types will be transformed as passed-by-reference. * 'SUBROUTINE' chunks are triggered by `CALL` keyword. 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`-`ELSE` `IF`-`ELSE` structure keeps unchanged. * `DO` loops are transformed as `for` loops 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 `GOTO` structures are transformed as `switch`-`case` structure in CIVL. === 2.2 Common Block Statements=== === 2.3 Inclusion === == 3 Expressions == == 4 Variables & Types == === 4.1 Scalar Types === === 4.2 Array Types & Array Sections === = Implemented standard rules = == Program Units == - main_program - subroutine_subprogram == Execution Structs and Controls == - block - specification_part - execution_part - execution_part_construct - executable_construct - do_construct - if_construct == Declarations and Statements == - declaration_construct - declaration_type_spec - intrinsic_type_spec - entity_decl - type_declaration_stmt - action_stmt - data_stmt - parameter_stmt - implicit_stmt - assignment_stmt - cycle_stmt - exit_stmt - goto_stmt - computed_goto_stmt - continue_stmt - write_stmt - print_stmt - call_stmt - return_stmt - pragma_stmt *(including some of OpenMP directives and CIVL primitives) == Expressions and Operators == - initialization - primary - level_1_expr - level_2_expr - level_3_expr - level_4_expr - level_5_expr - expr - mult_operand_mult_op - add_operand_add_op - and_operand_not_op - equiv_operand_equiv_op - level_5_expr_defined_binary_op == Values and Variables == - literal_constant - signed_int_literal_constant - int_literal_constant - signed_real_literal_constant - real_literal_constant - char_literal_constant - logical_literal_constant - named_constant_def - designator_or_func_ref - variable == Misc. == - label - attr_spec - array_spec