stanford-ppl / Green-Marl

A DSL for efficient Graph Analysis
Other
98 stars 36 forks source link

Code example v0.4 page 71 does not compile #104

Closed AustinBGibbons closed 11 years ago

AustinBGibbons commented 11 years ago

Was trying to use the argmin syntax from the guide, example does not compile

Proc foo(G: Graph, S1: Node_Set(G), A: N_P<Int>(G)) 
{
  Node_Set(G) S2;
  Foreach(s: S1.Items) (s.A >0) {
    S2.Add(s);
  }
  While(True) {
    Int m; Node(G) am;
    m = +INF;
    Foreach(s: S2.Items) {
    m <,am> min= s.A <,s>;
    }
    S2.Remove(am);
  }
}

Expected: compiles Actual:

make[1]: Entering directory `/lfs/madmax/0/austin/Green-Marl/apps/src'
../../bin/gm_comp -o=../output_cpp/generated -t=cpp_omp  dijkstra.gm
dijkstra.gm:36:7: error: syntax error, unexpected '<' (near ',')
make[1]: *** [../output_cpp/generated/dijkstra.cc] Error 1
make[1]: Leaving directory `/lfs/madmax/0/austin/Green-Marl/apps/src'
make: *** [gen] Error 2
hongsup commented 11 years ago

The syntax has been changed. Try <m; am> min = <s.A; s>

Instead.

On Mon, Nov 5, 2012 at 1:31 AM, Austin Gibbons notifications@github.comwrote:

Was trying to use the argmin syntax from the guide, example does not compile

Proc foo(G: Graph, S1: Node_Set(G), A: N_P(G)) { Node_Set(G) S2; Foreach(s: S1.Items) (s.A >0) { S2.Add(s); } While(True) { Int m; Node(G) am; m = +INF; Foreach(s: S2.Items) { m <,am> min= s.A <,s>; } S2.Remove(am); } }

Expected: compiles Actual:

make[1]: Entering directory /lfs/madmax/0/austin/Green-Marl/apps/src' ../../bin/gm_comp -o=../output_cpp/generated -t=cpp_omp dijkstra.gm dijkstra.gm:36:7: error: syntax error, unexpected '<' (near ',') make[1]: *** [../output_cpp/generated/dijkstra.cc] Error 1 make[1]: Leaving directory/lfs/madmax/0/austin/Green-Marl/apps/src' make: *\ [gen] Error 2

— Reply to this email directly or view it on GitHubhttps://github.com/stanford-ppl/Green-Marl/issues/104.

AustinBGibbons commented 11 years ago

Thanks