/* program toplevel */ program: /* empty */ | declaration_list ; declaration_list: declaration | declaration_list declaration ; declaration: ``Module'' IDENTIFIER ';' | ``FortranFormat'' STRING ';' | ``CompileOptions'' STRING ';' | ``Globals'' globals_body | ``Define'' interface_definition opt_string required interface_body ; interface_definition: IDENTIFIER '(' parameter_list ')' ; parameter_list: parameter | parameter_list ',' parameter ; parameter: decl_specifier declarator ; decl_specifier: type_specifier | MODE | MODE type_specifier | type_specifier MODE | type_specifier MODE type_specifier ; type_specifier: TYPE | TYPE TYPE | TYPE TYPE TYPE /* ex. unsigned long int */ | TYPENAME ; declarator: IDENTIFIER | '(' declarator ')' | declarator '['expr_or_null ']' | declarator '['expr ':' range_exprs ']' | '*' declarator ; range_exprs: expr /* upper limit */ | expr ',' expr /* lower limit and upper limit */ | expr ',' expr ',' expr /* lower, upper and step */ opt_string: /* empty */ | STRING ; required: /* empty */ | ``Required'' STRING ; interface_body: '{' /* C statements */ '}' | ``Calls'' opt_string IDENTIFIER '(' id_list ')' ';' ; globals_body: '{'/* C statements */ '}' ; id_list: IDENTIFIER | id_list ',' IDENTIFIER ; /* index descrition */ expr_or_null: expr | /* null */ ; expr: unary_expr | expr '/' expr | expr '%' expr | expr '+' expr | expr '-' expr | expr '*' expr ; unary_expr: primary_expr | '*' expr | '-' expr ; primary_expr: primary_expr '[' expr ']' | IDENTIFIER | CONSTANT | '(' expr ')' ; /* TYPE = int, unsigned, char, short, long, float, double */ /* MODE = mode_in, mode_out, mode_inout, mode_work, IN, OUT, INOUT, WORK*/ /* TYPENAME はまだサポートされていない */ /* IDENTIFER = 名前 */ /* CONSTANT = 整数、浮動小数点数 */ /* STRING = "..." */