The grammar can be found in <LooPoDir>/scanpars2/grammar.y. It is here included for easy reference:
program : definitions statements end_program | statements end_program | statements definitions | definitions end_program | definitions statements definitions | end_program ; end_program : dep definitions | dep | ; definitions : definitions definition | definition ; definition : c_prototype | f_prototype | c_function | f_function | CONSTANT bloblist ';' ; c_prototype : c_type IDPAR '(' c_parameters ')' ';' | IDPAR '(' c_parameters ')' ';' ; c_parameters : c_para_list | NOTYPE ; c_para_list : c_para_list ',' c_para | c_para ; c_para : intent IDID argument | intent argument ; argument : ID | IDCOM | IDPAR '[' ']' | IDPAR '[' numlist ']' ; c_function : c_type IDPAR '(' c_parameters ')' c_fct_body | IDPAR '(' c_parameters ')' c_fct_body ; c_type : IDID | NOTYPE ; c_fct_body : '{' lokals c_fct_stats '}' ; c_fct_stats : c_fct_stats statement | c_fct_stats RETURN expr ';' | c_fct_stats RETURN ';' | ; lokals : lokals list_of_lokals ';' | ; list_of_lokals : IDID arg_list ; arg_list : arg_list ',' arg | arg ; arg : ID | IDCOM | IDPAR '[' numlist ']' ; numlist : numlist ',' NUM | NUM ; f_prototype : SUBROUTINE fctname '(' f_parameters ')' fortran para_def_io END SUBROUTINE fctname | FUNCTION fctname '(' f_parameters ')' fortran para_def END FUNCTION fctname ; fortran : ; f_parameters : f_para_list | ; f_para_list : f_para_list ',' ID | ID | f_para_list ',' IDCOM | IDCOM ; para_def : para_def IDID f_arg_list | ; para_def_io : para_def_io def_io | ; def_io : IDCOM ',' INTENT '(' intent ')' DOPPELDOPPEL f_arg_list | IDID f_arg_list ; f_arg_list : f_arg_list ',' f_arg | f_arg ; intent : IN | OUT | INOUT ; f_arg : IDID | IDPAR '(' numlist ')' | arg ; f_function : SUBROUTINE fctname '(' f_parameters ')' fortran para_def_io statements END SUBROUTINE fctname | FUNCTION fctname '(' f_parameters ')' fortran para_def statements END FUNCTION fctname ; fctname : ID | IDPAR | IDID ; statements : statements statement | statement ; bloblist : bloblist ',' ID | bloblist ',' IDCOM | ID | IDCOM ; statement : skip | assignment | proccall | ifstatement | loop ; skip : SKIP | SKIP ';' ; assignment : array EQ cond | array EQ cond ';' | array ASSIGN cond ';' ; array : ID | IDPAR '[' exprlist ']' | IDPAR '(' exprlist ')' ; proccall : CALL procedure | procedure ';' | procedure ; procedure : IDPAR '(' exprlist ')' | IDPAR '(' ')' ; ifstatement : C_IF save_stmnt '(' cond ')' c_body %prec C_ELSE | C_IF save_stmnt '(' cond ')' c_body C_ELSE c_body | IF save_stmnt '(' cond ')' THEN statements END IF | IF save_stmnt '(' cond ')' THEN statements ELSE statements END IF ; save_stmnt : ; c_body : '{' statements '}' | '{' '}' | statement ; index : ID ; index_ : ID ; op : LE | LEQ | GE | GEQ | EQ | EQEQ ; loop : c_loop | f_loop | s1_loop | s2_loop ; c_loop : FOR '(' index EQ expr ';' index_ op expr ';' c_step ')' level c_body | C_WHILE '(' cond ')' level c_body ; c_step : index_ PLUSPLUS | index_ MINUSMINUS | index_ EQ index_ PLUS NUM | index_ EQ index_ MINUS NUM ; f_loop : DO funArray index EQ expr ',' expr f_step level f_s1_body END DO | DO funArray WHILE '(' cond ')' level f_s1_body END DO | DO funArray index EQ expr WHILE '(' cond ')' level f_s1_body END DO ; level : ; funArray : ; f_step : ',' sign NUM | ; sign : PLUS | MINUS | ; f_s1_body : statements | ; s2_loop : FOR funArray index EQ expr LEFT expr s2_step level statements ; s2_step : RIGHT sign NUM | ; s1_loop : FOR funArray index ASSIGN expr TO expr s1_step DOs level f_s1_body OD ; s1_step : STEP sign NUM | ; exprlist : exprlist ',' expr | expr ; expr : '(' expr ')' | expr PLUS expr | expr MINUS expr | expr TIMES expr | expr DIV expr | expr MOD expr | PLUS expr | MINUS expr %prec UMINUS | array_index_fctcall | NUM ; array_index_fctcall : IDPAR '[' exprlist ']' | IDPAR '(' exprlist ')' | IDPAR '(' ')' | IDCOM | IDID | ID ; dep : dep DEP NUM NUM matrix NUM NUM | DEP NUM NUM matrix NUM NUM ; matrix : ; cond : '(' cond ')' | expr | cond OR cond | cond AND cond | NOT cond %prec UMINUS | compare ; compare : expr op expr ;
The terminals are defined in the file <LooPoDir>/scanpars2/scan.l:
ws [ \t]+ number [0-9]+ ident [a-zA-Z][_0-9a-zA-Z]* %s comment %% "\n" { lineno++; } "/*" { BEGIN(comment); } <comment>"*/" { BEGIN(0); } <comment>[^*\n]+ ; <comment>. ; {ws} ; {number} { yylval->value=atoi(yytext); return loopoParser::NUM ; } for { return loopoParser::FOR ; } to { return loopoParser::TO ; } step { return loopoParser::STEP ; } do { return loopoParser::DOs ; } od { return loopoParser::OD ; } CONSTANT { return loopoParser::CONSTANT; } while { return loopoParser::C_WHILE ; } WHILE { return loopoParser::WHILE ; } if { return loopoParser::C_IF ; } else { return loopoParser::C_ELSE ; } return { return loopoParser::RETURN ; } IF { return loopoParser::IF ; } THEN { return loopoParser::THEN ; } ELSE { return loopoParser::ELSE ; } IN { return loopoParser::IN ; } OUT { return loopoParser::OUT ; } INOUT { return loopoParser::INOUT ; } INTENT { return loopoParser::INTENT ; } SUBROUTINE { return loopoParser::SUBROUTINE ; } FUNCTION { return loopoParser::FUNCTION ; } DO { return loopoParser::DO ; } END { return loopoParser::END ; } CALL { return loopoParser::CALL ; } dep { return loopoParser::DEP ; } denom { return loopoParser::DENOM; } skip { return loopoParser::SKIP ; } void { return loopoParser::NOTYPE ; } AND { return loopoParser::AND ; } OR { return loopoParser::OR ; } NOT { return loopoParser::NOT ; } "||" { return loopoParser::OR ; } "&&" { return loopoParser::AND ; } "!" { return loopoParser::NOT ; } ":=" { return loopoParser::ASSIGN ; } "::" { return loopoParser::DOPPELDOPPEL ; } "<" { return loopoParser::LE ; } "<=" { return loopoParser::LEQ ; } "=" { return loopoParser::EQ ; } "==" { return loopoParser::EQEQ ; } ">=" { return loopoParser::GEQ ; } ">" { return loopoParser::GE ; } "<-" { return loopoParser::LEFT ; } "->" { return loopoParser::RIGHT ; } "++" { return loopoParser::PLUSPLUS; } "--" { return loopoParser::MINUSMINUS ; } "+" { return loopoParser::PLUS ; } "-" { return loopoParser::MINUS ; } "*" { return loopoParser::TIMES ; } "/" { return loopoParser::DIV ; } "%" { return loopoParser::MOD ; }