diff --git a/Parser/spec/OmpPrinting.jadd b/Parser/spec/OmpPrinting.jadd index 26e8795171ebde0719f92125a2573c43c4e46c81..1bf47b4fd9a128fcfe5dd820a7e40e97e6259c32 100644 --- a/Parser/spec/OmpPrinting.jadd +++ b/Parser/spec/OmpPrinting.jadd @@ -1,17 +1,5 @@ class PrettyPrint { - // OmpVariableListItem:OmpListItem ::= Variable ; - public void OmpVariableListItem.prettyPrint(PrettyPrinter s) { - getVariable().prettyPrint(s); - } - // OmpArraySectionListItem:OmpListItem ::= ArraySection ; - public void OmpArraySectionListItem.prettyPrint(PrettyPrinter s) { - getArraySection().prettyPrint(s); - } - // OmpNameListItem:OmpListItem ::= Name ; - public void OmpNameListItem.prettyPrint(PrettyPrinter s) { - getName().prettyPrint(s); - } // ============================================================================= // Directives // ============================================================================= @@ -49,12 +37,12 @@ class PrettyPrint { } // OMP 2.12.7 - // OmpFlushDirective:OmpDirective ::= OmpListItem* ; + // OmpFlushDirective:OmpDirective ::= Variable* ; public void OmpFlushDirective.prettyPrint(PrettyPrinter s) { s.append("!$omp flush"); - if (getOmpListItemList().numChildren() > 0) { + if (getVariableList().numChildren() > 0) { s.append(" ("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } s.lb(); @@ -125,10 +113,10 @@ class PrettyPrint { } // OMP 2.14.2 - // OmpThreadprivateDirective:OmpDirective ::= OmpListItem* ; + // OmpThreadprivateDirective:OmpDirective ::= Variable* ; public void OmpThreadprivateDirective.prettyPrint(PrettyPrinter s) { s.append("!$omp threadprivate("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); s.lb(); } @@ -138,12 +126,12 @@ class PrettyPrint { // DeclarationConstructs // ============================================================================= - //// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment OmpListItem* ; + //// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment Variable* ; public void OmpDeclareTargetDirective.prettyPrint(PrettyPrinter s) { s.append("!$omp declare target"); - if (getOmpListItemList().numChildren() > 0) { + if (getVariableList().numChildren() > 0) { s.append("("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } s.lb(); @@ -1006,10 +994,10 @@ class PrettyPrint { // Clauses // ============================================================================= - // OmpAlignedClause:OmpClause ::= OmpListItem* Expr ; + // OmpAlignedClause:OmpClause ::= Variable* Expr ; public void OmpAlignedClause.prettyPrint(PrettyPrinter s) { s.append("aligned("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); if (hasExpr()) { s.append(":"); getExpr().prettyPrint(s); @@ -1024,17 +1012,17 @@ class PrettyPrint { s.append(")"); } - // OmpCopyinClause:OmpClause ::= OmpListItem* ; + // OmpCopyinClause:OmpClause ::= Variable* ; public void OmpCopyinClause.prettyPrint(PrettyPrinter s) { s.append("copyin("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } - // OmpCopyprivateClause:OmpClause ::= OmpListItem* ; + // OmpCopyprivateClause:OmpClause ::= Variable* ; public void OmpCopyprivateClause.prettyPrint(PrettyPrinter s) { s.append("copyprivate("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } @@ -1068,19 +1056,19 @@ class PrettyPrint { // OmpDependInClause:OmpDependClause ; public void OmpDependInClause.prettyPrint(PrettyPrinter s) { s.append("depend(in: "); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } // OmpDependOutClause:OmpDependClause ; public void OmpDependOutClause.prettyPrint(PrettyPrinter s) { s.append("depend(out: "); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } // OmpDependInoutClause:OmpDependClause ; public void OmpDependInoutClause.prettyPrint(PrettyPrinter s) { s.append("depend(inout: "); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } @@ -1098,10 +1086,10 @@ class PrettyPrint { s.append(")"); } - // OmpFirstPrivateClause:OmpClause ::= OmpListItem* ; + // OmpFirstPrivateClause:OmpClause ::= Variable* ; public void OmpFirstPrivateClause.prettyPrint(PrettyPrinter s) { s.append("firstprivate("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } @@ -1112,24 +1100,24 @@ class PrettyPrint { s.append(")"); } - //// OmpFromClause:OmpClause ::= OmpListItem* ; + //// OmpFromClause:OmpClause ::= Variable* ; public void OmpFromClause.prettyPrint(PrettyPrinter s) { s.append("from("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } - // OmpLastPrivateClause:OmpClause ::= OmpListItem* ; + // OmpLastPrivateClause:OmpClause ::= Variable* ; public void OmpLastPrivateClause.prettyPrint(PrettyPrinter s) { s.append("lastprivate("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } - //// OmpLinearClause:OmpClause ::= OmpListItem* [Expr] ; + //// OmpLinearClause:OmpClause ::= Variable* [Expr] ; public void OmpLinearClause.prettyPrint(PrettyPrinter s) { s.append("linear("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); if (hasExpr()) { s.append(":"); getExpr().prettyPrint(s); @@ -1140,25 +1128,25 @@ class PrettyPrint { // OmpMapAllocClause:OmpMapClause ; public void OmpMapAllocClause.prettyPrint(PrettyPrinter s) { s.append("map(alloc: "); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } // OmpMapToClause:OmpMapClause ; public void OmpMapToClause.prettyPrint(PrettyPrinter s) { s.append("map(to: "); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } // OmpMapFromClause:OmpMapClause ; public void OmpMapFromClause.prettyPrint(PrettyPrinter s) { s.append("map(from: "); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } // OmpMapTofromClause:OmpMapClause ; public void OmpMapTofromClause.prettyPrint(PrettyPrinter s) { s.append("map(tofrom: "); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } @@ -1167,7 +1155,7 @@ class PrettyPrint { s.append("mergeable"); } - //// OmpNowaitClause:OmpClause ::= OmpListItem* ; + //// OmpNowaitClause:OmpClause ::= Variable* ; public void OmpNowaitClause.prettyPrint(PrettyPrinter s) { s.append("nowait"); } @@ -1191,10 +1179,10 @@ class PrettyPrint { s.append("ordered"); } - // OmpPrivateClause:OmpClause ::= OmpListItem* ; + // OmpPrivateClause:OmpClause ::= Variable* ; public void OmpPrivateClause.prettyPrint(PrettyPrinter s) { s.append("private("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } @@ -1212,12 +1200,12 @@ class PrettyPrint { } - // OmpReductionClause:OmpClause ::= OmpReductionIdentifier OmpListItem* ; + // OmpReductionClause:OmpClause ::= OmpReductionIdentifier Variable* ; public void OmpReductionClause.prettyPrint(PrettyPrinter s) { s.append("reduction("); getOmpReductionIdentifier().prettyPrint(s); s.append(":"); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } @@ -1308,10 +1296,10 @@ class PrettyPrint { s.append("schedule(runtime)"); } - // OmpSharedClause:OmpClause ::= OmpListItem* ; + // OmpSharedClause:OmpClause ::= Variable* ; public void OmpSharedClause.prettyPrint(PrettyPrinter s) { s.append("shared("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } @@ -1322,10 +1310,10 @@ class PrettyPrint { s.append(")"); } - //// OmpToClause:OmpClause ::= OmpListItem* ; + //// OmpToClause:OmpClause ::= Variable* ; public void OmpToClause.prettyPrint(PrettyPrinter s) { s.append("to("); - getOmpListItemList().prettyPrintJoin(s, ", "); + getVariableList().prettyPrintJoin(s, ", "); s.append(")"); } diff --git a/Parser/spec/OpenMp.rats b/Parser/spec/OpenMp.rats index aee2ba24f5600bc44132d496f045f2e43c30e0c8..c2c1e356bba7abea09f591c579c82554e5f7af95 100644 --- a/Parser/spec/OpenMp.rats +++ b/Parser/spec/OpenMp.rats @@ -25,26 +25,10 @@ DoConstruct do_construct += / <BEGINNING> ... ; -//// abstract OmpListItem ; -//// // TODO rewrite to support common block names -//// OmpVariableListItem:OmpListItem ::= Variable ; -//// OmpArraySectionListItem:OmpListItem ::= ArraySection ; -//// OmpNameListItem:OmpListItem ::= Name ; -OmpListItem omp_list_item = - a:array_section +List<Variable> omp_list = + v:variable vl:(COMMA yyValue:variable)* { - yyValue = new OmpArraySectionListItem(a); - } -/ v:variable - { - yyValue = new OmpVariableListItem(v); - } -; - -List<OmpListItem> omp_list = - i:omp_list_item il:(COMMA yyValue:omp_list_item)* - { - yyValue = new List().add(i).addAll(il.list()); + yyValue = new List().add(v).addAll(vl.list()); } ; @@ -108,7 +92,7 @@ OmpTaskwaitDirective omp_taskwait_directive = ; //// // OMP 2.12.7 -//// OmpFlushDirective:OmpDirective ::= OmpListItem* ; +//// OmpFlushDirective:OmpDirective ::= Variable* ; OmpFlushDirective omp_flush_directive = O_P O_FLUSH LPAREN l:omp_list RPAREN lnc:comment { @@ -175,7 +159,7 @@ OmpCancellationPointDirective omp_cancellation_point_directive = ; //// // OMP 2.14.2 -//// OmpThreadprivateDirective:OmpDirective ::= OmpListItem* ; +//// OmpThreadprivateDirective:OmpDirective ::= Variable* ; OmpThreadprivateDirective omp_threadprivate_directive = O_P O_THREADPRIVATE LPAREN l:omp_list RPAREN lnc:comment { @@ -192,7 +176,7 @@ OmpDeclarationConstruct omp_declaration_construct = omp_declare_target_directive ; -//// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment OmpListItem* ; +//// OmpDeclareTargetDirective:OmpDeclarationConstruct ::= Comment Variable* ; OmpDeclareTargetDirective omp_declare_target_directive = O_P O_DECLARE O_TARGET LPAREN l:omp_list RPAREN lnc:comment { @@ -1408,7 +1392,7 @@ OmpClause omp_clause = / omp_untied_clause ; -//// OmpAlignedClause:OmpClause ::= OmpListItem* [Expr] ; +//// OmpAlignedClause:OmpClause ::= Variable* [Expr] ; OmpAlignedClause omp_aligned_clause = O_ALIGNED LPAREN l:omp_list e:(COLON yyValue:expr)? RPAREN { @@ -1425,7 +1409,7 @@ OmpCollapseClause omp_collapse_clause = } ; -//// OmpCopyinClause:OmpClause ::= OmpListItem* ; +//// OmpCopyinClause:OmpClause ::= Variable* ; OmpCopyinClause omp_copyin_clause = O_COPYIN LPAREN l:omp_list RPAREN { @@ -1433,7 +1417,7 @@ OmpCopyinClause omp_copyin_clause = } ; -//// OmpCopyprivateClause:OmpClause ::= OmpListItem* ; +//// OmpCopyprivateClause:OmpClause ::= Variable* ; OmpCopyprivateClause omp_copyprivate_clause = O_COPYPRIVATE LPAREN l:omp_list RPAREN { @@ -1465,7 +1449,7 @@ OmpDefaultClause omp_default_clause = } ; -//// abstract OmpDependClause:OmpClause ::= OmpListItem* ; +//// abstract OmpDependClause:OmpClause ::= Variable* ; //// OmpDependInClause:OmpDependClause ; //// OmpDependOutClause:OmpDependClause ; //// OmpDependInoutClause:OmpDependClause ; @@ -1509,7 +1493,7 @@ OmpFinalClause omp_final_clause = } ; -//// OmpFirstPrivateClause:OmpClause ::= OmpListItem* ; +//// OmpFirstPrivateClause:OmpClause ::= Variable* ; OmpFirstPrivateClause omp_firstprivate_clause = O_FIRSTPRIVATE LPAREN l:omp_list RPAREN { @@ -1525,7 +1509,7 @@ OmpIfClause omp_if_clause = } ; -//// OmpFromClause:OmpClause ::= OmpListItem* ; +//// OmpFromClause:OmpClause ::= Variable* ; OmpFromClause omp_from_clause = O_FROM LPAREN l:omp_list RPAREN { @@ -1533,7 +1517,7 @@ OmpFromClause omp_from_clause = } ; -//// OmpLastPrivateClause:OmpClause ::= OmpListItem* ; +//// OmpLastPrivateClause:OmpClause ::= Variable* ; OmpLastPrivateClause omp_lastprivate_clause = O_LASTPRIVATE LPAREN l:omp_list RPAREN { @@ -1541,7 +1525,7 @@ OmpLastPrivateClause omp_lastprivate_clause = } ; -//// OmpLinearClause:OmpClause ::= OmpListItem* [Expr] ; +//// OmpLinearClause:OmpClause ::= Variable* [Expr] ; OmpLinearClause omp_linear_clause = O_LINEAR LPAREN l:omp_list e:(COLON yyValue:expr)? RPAREN { @@ -1550,7 +1534,7 @@ OmpLinearClause omp_linear_clause = } ; -//// abstract OmpMapClause:OmpClause ::= OmpListItem* ; +//// abstract OmpMapClause:OmpClause ::= Variable* ; //// OmpMapAllocClause:OmpMapClause ; //// OmpMapToClause:OmpMapClause ; //// OmpMapFromClause:OmpMapClause ; @@ -1586,7 +1570,7 @@ OmpMergeableClause omp_mergeable_clause = } ; -//// OmpNowaitClause:OmpClause ::= OmpListItem* ; +//// OmpNowaitClause:OmpClause ::= Variable* ; OmpNowaitClause omp_nowait_clause = O_NOWAIT { @@ -1618,7 +1602,7 @@ OmpOrderedClause omp_ordered_clause = } ; -//// OmpPrivateClause:OmpClause ::= OmpListItem* ; +//// OmpPrivateClause:OmpClause ::= Variable* ; OmpPrivateClause omp_private_clause = O_PRIVATE LPAREN l:omp_list RPAREN { @@ -1645,7 +1629,7 @@ OmpProcBindClause omp_proc_bind_clause = } ; -//// OmpReductionClause:OmpClause ::= OmpReductionIdentifier OmpListItem* ; +//// OmpReductionClause:OmpClause ::= OmpReductionIdentifier Variable* ; OmpReductionClause omp_reduction_clause = O_REDUCTION LPAREN i:omp_reduction_identifier COLON l:omp_list RPAREN { @@ -1760,7 +1744,7 @@ OmpScheduleClause omp_schedule_clause = ; -//// OmpSharedClause:OmpClause ::= OmpListItem* ; +//// OmpSharedClause:OmpClause ::= Variable* ; OmpSharedClause omp_shared_clause = O_SHARED LPAREN l:omp_list RPAREN { @@ -1776,7 +1760,7 @@ OmpThreadLimitClause omp_thread_limit_clause = } ; -//// OmpToClause:OmpClause ::= OmpListItem* ; +//// OmpToClause:OmpClause ::= Variable* ; OmpToClause omp_to_clause = O_TO LPAREN l:omp_list RPAREN {