Charj : added support for the following methods
authorMinas Charalambides <charala1@illinois.edu>
Mon, 7 Jun 2010 07:15:19 +0000 (02:15 -0500)
committerMinas Charalambides <charala1@illinois.edu>
Mon, 7 Jun 2010 07:15:19 +0000 (02:15 -0500)
            getMyPe()       ->  CkMyPe()
            getMyNode()     ->  CkMyNode()
            getNumNodes()   ->  CkNumNodes()
            getNumPes()     ->  CkNumPes()
            getMyRank()     ->  CkMyRank()

src/langs/charj/src/charj/translator/Charj.g
src/langs/charj/src/charj/translator/CharjAST.java
src/langs/charj/src/charj/translator/CharjASTModifier.g
src/langs/charj/src/charj/translator/CharjEmitter.g
src/langs/charj/src/charj/translator/CharjSemantics.g

index 8d68210104ba6c82701c92ffd6e988d27f40fdd8..8bd1ba11c9705a7f5f03ce5bc085907e8e231752 100644 (file)
@@ -58,6 +58,11 @@ tokens {
     PRINTLN                 = 'println'         ;
     EXIT                    = 'exit'            ;
     EXITALL                 = 'exitAll'         ;
+    GETMYPE                 = 'getMyPe'         ;
+    GETMYRANK               = 'getMyRank'       ;
+    GETMYNODE               = 'getMyNode'       ;
+    GETNUMPES               = 'getNumPes'       ;
+    GETNUMNODES             = 'getNumNodes'     ;
 
     FOR                     = 'for'             ;
     WHILE                   = 'while'           ;
@@ -597,6 +602,7 @@ nonBlockStatement
         ->  ^(EXIT expression?)
     |   EXITALL '(' ')' ';'
         ->  EXITALL
+
     ;           
         
 
@@ -813,6 +819,16 @@ primaryExpression
             ->  ^(METHOD_CALL ^(DOT SUPER IDENT) arguments)
         |   ->  ^(DOT SUPER IDENT)
         )
+    |   GETMYPE '(' ')'
+        ->  GETMYPE
+    |   GETNUMPES '(' ')'
+        ->  GETNUMPES
+    |   GETMYRANK '(' ')'
+        ->  GETMYRANK
+    |   GETMYNODE '(' ')'
+        -> GETMYNODE
+    |   GETNUMNODES '(' ')'
+        -> GETNUMNODES
     ;
     
 qualifiedIdentExpression
index ec19a01f08b155022b4413f13236bf92e5d649bd..93e1879ba881f7b0a7e229d4b8703afc9ceb62ab 100644 (file)
@@ -128,7 +128,7 @@ public class CharjAST extends CommonTree
         }
         catch(NullPointerException npe)
         {
-            npe.printStackTrace();
+            //npe.printStackTrace();
             if(index == 0)
                 addChild(node);
             else
index 2dbdf6aae4301b616122a222bbe0d3e1c974de2a..929b0d1388b5c1192acb099b84805c1e67b403aa 100644 (file)
@@ -409,6 +409,11 @@ primaryExpression
     |   THIS
     |   arrayTypeDeclarator
     |   SUPER
+    |   GETNUMPES
+    |   GETNUMNODES
+    |   GETMYPE
+    |   GETMYNODE
+    |   GETMYRANK
     ;
     
 explicitConstructorCall
index 322c643784ba5f6f570ada9d8598cfb78c00d2da..8de9fc6d6c8aff8bbd6ae133683e750139e75d82 100644 (file)
@@ -750,6 +750,17 @@ primaryExpression
         -> {$arrayTypeDeclarator.st}
     |   SUPER
         -> {%{$start.getText()}}
+    |   GETNUMPES
+        ->  template() "CkNumPes()"
+    |   GETNUMNODES
+        ->  template() "CkNumNodes()"
+    |   GETMYPE
+        ->  template() "CkMyPe()"
+    |   GETMYNODE
+        ->  template() "CkMyNode()"
+    |   GETMYRANK
+        ->  template() "CkMyRank()"
+
     ;
     
 explicitConstructorCall
index 009c47ced6a6a5eac1aa2ae40b07462616163acb..e7d3fcf92581f901dec23725412ac5b11b390d50 100644 (file)
@@ -542,6 +542,11 @@ primaryExpression
     |   THIS
     |   arrayTypeDeclarator
     |   SUPER
+    |   GETNUMPES
+    |   GETNUMNODES
+    |   GETMYPE
+    |   GETMYNODE
+    |   GETMYRANK
     ;
     
 explicitConstructorCall