Skip to content
Snippets Groups Projects
Commit e1869741 authored by Johannes Mey's avatar Johannes Mey
Browse files

rewrite of loop contructs

parent 3767739d
No related branches found
No related tags found
No related merge requests found
...@@ -4608,81 +4608,98 @@ EndCriticalStmt end_critical_stmt = ...@@ -4608,81 +4608,98 @@ EndCriticalStmt end_critical_stmt =
//// abstract DoConstruct:ExecutableConstruct ; //// abstract DoConstruct:ExecutableConstruct ;
DoConstruct do_construct = DoConstruct do_construct =
<BEGINNING> <BEGINNING>
block_do_concurrent_construct block_do_construct
/ block_do_while_construct
/ block_do_construct
; ;
//// // R814 //// // R814
//// BlockDoConstruct:DoConstruct ::= DoStmt DoBlock EndDo ; //// BlockDoConstruct:DoConstruct ::= DoBlock EndDo ;
BlockDoConstruct block_do_construct = BlockDoConstruct block_do_construct =
s:do_stmt b:do_block e:end_do <BEGINNING>
do_concurrent_construct
/ do_while_construct
/ simple_do_construct
/ infinite_do_construct
;
//// SimpleDoConstruct:BlockDoConstruct ::= DoStmt:SimpleDoStmt DoBlock EndDo ;
SimpleDoConstruct simple_do_construct =
s:simple_do_stmt b:do_block e:end_do
{ {
yyValue = new BlockDoConstruct(s, b, e); yyValue = new SimpleDoConstruct(s, b, e);
} }
; ;
//// BlockDoConcurrentConstruct:DoConstruct ::= DoStmt DoBlock EndDo ; //// InfiniteDoConstruct:BlockDoConstruct ::= DoStmt:InfiniteDoStmt DoBlock EndDo ;
BlockDoConcurrentConstruct block_do_concurrent_construct = InfiniteDoConstruct infinite_do_construct =
s:infinite_do_stmt b:do_block e:end_do
{
yyValue = new InfiniteDoConstruct(s, b, e);
}
;
//// DoConcurrentConstruct:BlockDoConstruct ::= DoStmt:DoConcurrentStmt DoBlock EndDo ;
DoConcurrentConstruct do_concurrent_construct =
s:do_concurrent_stmt b:do_block e:end_do s:do_concurrent_stmt b:do_block e:end_do
{ {
yyValue = new BlockDoConcurrentConstruct(s, b, e); yyValue = new DoConcurrentConstruct(s, b, e);
} }
; ;
//// BlockDoWhileConstruct:DoConstruct ::= DoStmt DoBlock EndDo ; //// DoWhileConstruct:BlockDoConstruct ::= DoStmt:DoWhileStmt DoBlock EndDo ;
BlockDoWhileConstruct block_do_while_construct = DoWhileConstruct do_while_construct =
s:do_while_stmt b:do_block e:end_do s:do_while_stmt b:do_block e:end_do
{ {
yyValue = new BlockDoWhileConstruct(s, b, e); yyValue = new DoWhileConstruct(s, b, e);
} }
; ;
//// // R815 //// // R815
//// DoStmt:AbstractStmt ::= [DoConstructName:Name] [LoopControl]; //// abstract DoStmt:AbstractStmt ::= [DoConstructName:Name];
DoStmt do_stmt = DoStmt do_stmt =
n:(yyValue:name COLON)? DO l:label c:(simple_loop_control)? lnc:comment infinite_do_stmt
{ / simple_do_stmt
Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n); / do_concurrent_stmt
Opt<LoopControl> c_opt = (c==null) ? new Opt<LoopControl>() : new Opt<LoopControl>(c); / do_while_stmt
yyValue = new DoStmt(new Opt<Label>(l), lnc, n_opt, c_opt);
}
/ n:(yyValue:name COLON)? DO c:(simple_loop_control)? lnc:comment
{
Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n);
Opt<LoopControl> c_opt = (c==null) ? new Opt<LoopControl>() : new Opt<LoopControl>(c);
yyValue = new DoStmt(new Opt<Label>(), lnc, n_opt, c_opt);
}
; ;
DoStmt do_concurrent_stmt = //// InfiniteDoStmt:DoStmt ;
n:(yyValue:name COLON)? DO l:label c:concurrent_loop_control lnc:comment InfiniteDoStmt infinite_do_stmt =
n:(yyValue:name COLON)? DO l:label? lnc:comment
{ {
Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n); Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n);
Opt<LoopControl> c_opt = (c==null) ? new Opt<LoopControl>() : new Opt<LoopControl>(c); Opt<Label> l_opt = (l==null) ? new Opt<Label>() : new Opt<Label>(l);
yyValue = new DoStmt(new Opt<Label>(l), lnc, n_opt, c_opt); yyValue = new InfiniteDoStmt(l_opt, lnc, n_opt);
} }
/ n:(yyValue:name COLON)? DO c:concurrent_loop_control lnc:comment ;
//// SimpleDoStmt:DoStmt ::= SimpleLoopControl;
SimpleDoStmt simple_do_stmt =
n:(yyValue:name COLON)? DO l:label? c:simple_loop_control lnc:comment
{ {
Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n); Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n);
Opt<LoopControl> c_opt = (c==null) ? new Opt<LoopControl>() : new Opt<LoopControl>(c); Opt<Label> l_opt = (l==null) ? new Opt<Label>() : new Opt<Label>(l);
yyValue = new DoStmt(new Opt<Label>(), lnc, n_opt, c_opt); yyValue = new SimpleDoStmt(l_opt, lnc, n_opt, c);
} }
; ;
DoStmt do_while_stmt = //// DoConcurrentStmt:DoStmt ::= ConcurrentLoopControl ;
n:(yyValue:name COLON)? DO l:label c:while_loop_control lnc:comment DoConcurrentStmt do_concurrent_stmt =
n:(yyValue:name COLON)? DO l:label? c:concurrent_loop_control lnc:comment
{ {
Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n); Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n);
Opt<LoopControl> c_opt = (c==null) ? new Opt<LoopControl>() : new Opt<LoopControl>(c); Opt<Label> l_opt = (l==null) ? new Opt<Label>() : new Opt<Label>(l);
yyValue = new DoStmt(new Opt<Label>(l), lnc, n_opt, c_opt); yyValue = new DoConcurrentStmt(l_opt, lnc, n_opt, c);
} }
/ n:(yyValue:name COLON)? DO c:while_loop_control lnc:comment ;
//// DoWhileStmt:DoStmt ::= WhileLoopControl ;
DoWhileStmt do_while_stmt =
n:(yyValue:name COLON)? DO l:label? c:while_loop_control lnc:comment
{ {
Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n); Opt<Name> n_opt = (n==null) ? new Opt<Name>() : new Opt<Name>(n);
Opt<LoopControl> c_opt = (c==null) ? new Opt<LoopControl>() : new Opt<LoopControl>(c); Opt<Label> l_opt = (l==null) ? new Opt<Label>() : new Opt<Label>(l);
yyValue = new DoStmt(new Opt<Label>(), lnc, n_opt, c_opt); yyValue = new DoWhileStmt(l_opt, lnc, n_opt, c);
} }
; ;
......
...@@ -244,7 +244,7 @@ AccEndAtomicStmt acc_end_atomic_stmt = ...@@ -244,7 +244,7 @@ AccEndAtomicStmt acc_end_atomic_stmt =
; ;
// loop constructs ------------------------------------------------------------- // loop constructs -------------------------------------------------------------
//// abstract AccDoConstruct:DoConstruct ; //// abstract AccDoConstruct:DoConstruct ::= DoConstruct ;
AccDoConstruct acc_do_construct = AccDoConstruct acc_do_construct =
acc_loop_construct acc_loop_construct
/ acc_parallel_loop_construct / acc_parallel_loop_construct
......
...@@ -798,7 +798,7 @@ OmpEndOrderedStmt omp_end_ordered_stmt = ...@@ -798,7 +798,7 @@ OmpEndOrderedStmt omp_end_ordered_stmt =
// Loop Constructs // Loop Constructs
// ============================================================================= // =============================================================================
//// abstract OmpLoopConstruct:DoConstruct ; //// abstract OmpLoopConstruct:DoConstruct ::= DoConstruct ;
OmpLoopConstruct omp_loop_construct = OmpLoopConstruct omp_loop_construct =
omp_do_construct omp_do_construct
/ omp_simd_construct / omp_simd_construct
......
...@@ -2881,7 +2881,7 @@ class PrettyPrint { ...@@ -2881,7 +2881,7 @@ class PrettyPrint {
} }
// R814 // R814
public void BlockDoConstruct.prettyPrint(PrettyPrinter s) { public void SimpleDoConstruct.prettyPrint(PrettyPrinter s) {
getDoStmt().prettyPrint(s); getDoStmt().prettyPrint(s);
s.ind(); s.ind();
getDoBlock().prettyPrint(s); getDoBlock().prettyPrint(s);
...@@ -2889,7 +2889,7 @@ class PrettyPrint { ...@@ -2889,7 +2889,7 @@ class PrettyPrint {
getEndDo().prettyPrint(s); getEndDo().prettyPrint(s);
} }
public void BlockDoConcurrentConstruct.prettyPrint(PrettyPrinter s) { public void InfiniteDoConstruct.prettyPrint(PrettyPrinter s) {
getDoStmt().prettyPrint(s); getDoStmt().prettyPrint(s);
s.ind(); s.ind();
getDoBlock().prettyPrint(s); getDoBlock().prettyPrint(s);
...@@ -2897,7 +2897,15 @@ class PrettyPrint { ...@@ -2897,7 +2897,15 @@ class PrettyPrint {
getEndDo().prettyPrint(s); getEndDo().prettyPrint(s);
} }
public void BlockDoWhileConstruct.prettyPrint(PrettyPrinter s) { public void DoConcurrentConstruct.prettyPrint(PrettyPrinter s) {
getDoStmt().prettyPrint(s);
s.ind();
getDoBlock().prettyPrint(s);
s.und();
getEndDo().prettyPrint(s);
}
public void DoWhileConstruct.prettyPrint(PrettyPrinter s) {
getDoStmt().prettyPrint(s); getDoStmt().prettyPrint(s);
s.ind(); s.ind();
getDoBlock().prettyPrint(s); getDoBlock().prettyPrint(s);
...@@ -2906,7 +2914,32 @@ class PrettyPrint { ...@@ -2906,7 +2914,32 @@ class PrettyPrint {
} }
// R815 // R815
public void DoStmt.prettyPrint(PrettyPrinter s) { public void InfiniteDoStmt.prettyPrint(PrettyPrinter s) {
if (hasDoConstructName()) {
getDoConstructName().prettyPrint(s);
s.append(": ");
}
s.append("DO");
if (hasLabel()) {
s.append(" ");
getLabel().prettyPrint(s);
}
getComment().prettyPrint(s);
}
public void SimpleDoStmt.prettyPrint(PrettyPrinter s) {
if (hasDoConstructName()) {
getDoConstructName().prettyPrint(s);
s.append(": ");
}
s.append("DO ");
if (hasLabel()) {
getLabel().prettyPrint(s);
s.append(" ");
}
getSimpleLoopControl().prettyPrint(s);
getComment().prettyPrint(s);
}
public void DoConcurrentStmt.prettyPrint(PrettyPrinter s) {
if (hasDoConstructName()) { if (hasDoConstructName()) {
getDoConstructName().prettyPrint(s); getDoConstructName().prettyPrint(s);
s.append(": "); s.append(": ");
...@@ -2916,9 +2949,20 @@ class PrettyPrint { ...@@ -2916,9 +2949,20 @@ class PrettyPrint {
getLabel().prettyPrint(s); getLabel().prettyPrint(s);
s.append(" "); s.append(" ");
} }
if (hasLoopControl()) { getConcurrentLoopControl().prettyPrint(s);
getLoopControl().prettyPrint(s); getComment().prettyPrint(s);
}
public void DoWhileStmt.prettyPrint(PrettyPrinter s) {
if (hasDoConstructName()) {
getDoConstructName().prettyPrint(s);
s.append(": ");
}
s.append("DO ");
if (hasLabel()) {
getLabel().prettyPrint(s);
s.append(" ");
} }
getWhileLoopControl().prettyPrint(s);
getComment().prettyPrint(s); getComment().prettyPrint(s);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment