Charj : producing the pup routine now generates an OBJECT_REFERENCE
authorMinas Charalambides <charala1@illinois.edu>
Wed, 26 May 2010 05:48:30 +0000 (00:48 -0500)
committerMinas Charalambides <charala1@illinois.edu>
Wed, 26 May 2010 05:48:30 +0000 (00:48 -0500)
            node for the PUP::er object

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

index 742243984cec660f0cc4b375015392bd85f2005a..5dfc8f4d294dc4fb68613ea2ea970385b6724dc3 100644 (file)
@@ -67,6 +67,7 @@ tokens {
     THROW                   = 'throw'           ;
     BREAK                   = 'break'           ;
 
+    NEW                     = 'new'             ;
     BITWISE_OR              = '|'               ;
     BITWISE_AND             = '&'               ;
     EQUALS                  = '='               ;
@@ -411,7 +412,7 @@ simpleType
 
 objectType
     :   qualifiedTypeIdent arrayDeclaratorList?
-        ->  ^(OBJECT_TYPE qualifiedTypeIdent arrayDeclaratorList?)
+        ->  ^(POINTER_TYPE qualifiedTypeIdent arrayDeclaratorList?)
     ;
 
 qualifiedTypeIdent
@@ -709,8 +710,8 @@ postfixedExpression
                 (   arguments
                     ->  ^(METHOD_CALL $postfixedExpression genericTypeArgumentList? arguments)
                 )?
-            |   'this'
-                ->  ^($outerDot $postfixedExpression 'this')
+            |   THIS
+                ->  ^($outerDot $postfixedExpression THIS)
             |   s='super' arguments
                 ->  ^(SUPER_CONSTRUCTOR_CALL[$s, "SUPER_CONSTRUCTOR_CALL"] $postfixedExpression arguments)
             |   (   'super' innerDot='.' IDENT
@@ -743,11 +744,11 @@ primaryExpression
             )
         |   IDENT arguments
             ->  ^(METHOD_CALL IDENT genericTypeArgumentList arguments)
-        |   t='this' arguments
+        |   t=THIS arguments
             ->  ^(THIS_CONSTRUCTOR_CALL[$t, "THIS_CONSTRUCTOR_CALL"] genericTypeArgumentList arguments)
         )
-    |   (   'this'
-            ->  'this'
+    |   (   THIS
+            ->  THIS
         )
         (   arguments
             ->  ^(THIS_CONSTRUCTOR_CALL[$t, "THIS_CONSTRUCTOR_CALL"] arguments)
@@ -781,8 +782,8 @@ qualifiedIdentExpression
                 |   IDENT arguments
                     ->  ^(METHOD_CALL ^($outerDot qualifiedIdentifier IDENT) genericTypeArgumentList arguments)
                 )
-            |   'this'
-                ->  ^($outerDot qualifiedIdentifier 'this')
+            |   THIS
+                ->  ^($outerDot qualifiedIdentifier THIS)
             |   s='super' arguments
                 ->  ^(SUPER_CONSTRUCTOR_CALL[$s, "SUPER_CONSTRUCTOR_CALL"] qualifiedIdentifier arguments)
             )
@@ -790,14 +791,14 @@ qualifiedIdentExpression
     ;
 
 newExpression
-    :   n='new'
+    :   n=NEW
         (   primitiveType newArrayConstruction          // new static array of primitive type elements
             ->  ^(STATIC_ARRAY_CREATOR[$n, "STATIC_ARRAY_CREATOR"] primitiveType newArrayConstruction)
         |   genericTypeArgumentList? qualifiedTypeIdent
                 newArrayConstruction                // new static array of object type reference elements
             ->  ^(STATIC_ARRAY_CREATOR[$n, "STATIC_ARRAY_CREATOR"] genericTypeArgumentList? qualifiedTypeIdent newArrayConstruction)
         |   qualifiedTypeIdent arguments
-            -> ^('new' qualifiedTypeIdent arguments)
+            -> ^(NEW qualifiedTypeIdent arguments)
         )
     ;
     
index 91b7272f0e669393a18a586f6a18d3686d4a3248..a87844470257df290ec4eaa44df1fecb69dfa29b 100644 (file)
@@ -373,7 +373,7 @@ newExpression
             |   genericTypeArgumentList? qualifiedTypeIdent newArrayConstruction
             )
         )
-    |   ^('new' qualifiedTypeIdent arguments)
+    |   ^(NEW qualifiedTypeIdent arguments)
     ;
 
 newArrayConstruction
index e41a48b3cebc864cd7f3731b81616d6976579204..81353f56b630147d7ab9280d2e9bbdb0994e839a 100644 (file)
@@ -382,11 +382,11 @@ simpleType
     ;
 
 objectType
-    :   ^(OBJECT qualifiedTypeIdent arrayDeclaratorList?)
+    :   ^(OBJECT_TYPE qualifiedTypeIdent arrayDeclaratorList?)
         -> obj_type(typeID={$qualifiedTypeIdent.st}, arrDeclList={$arrayDeclaratorList.st})
-    |   ^(OBJECT_POINTER qualifiedTypeIdent arrayDeclaratorList?)
+    |   ^(POINTER_TYPE qualifiedTypeIdent arrayDeclaratorList?)
         -> pointer_type(typeID={$qualifiedTypeIdent.st}, arrDeclList={$arrayDeclaratorList.st})
-    |   ^(OBJECT_REFERENCE qualifiedTypeIdent arrayDeclaratorList?)
+    |   ^(REFERENCE_TYPE qualifiedTypeIdent arrayDeclaratorList?)
         -> reference_type(typeID={$qualifiedTypeIdent.st}, arrDeclList={$arrayDeclaratorList.st})
     ;
 
@@ -686,7 +686,7 @@ newExpression
             )
         )
         -> template(t={$text}) "<t>"
-    |   ^('new' qualifiedTypeIdent arguments)
+    |   ^(NEW qualifiedTypeIdent arguments)
         -> template(q={$qualifiedTypeIdent.st}, a={$arguments.st}) "new <q>(<a>)"
     ;
 
index 7cc3e65ed5ae14992ee5c87ee1a2983c24123981..e51d637ac96aaa723ea3d82f656e8dbac8dab231 100644 (file)
@@ -458,7 +458,7 @@ newExpression
             |   genericTypeArgumentList? qualifiedTypeIdent newArrayConstruction
             )
         )
-    |   ^('new' qualifiedTypeIdent arguments)
+    |   ^(NEW qualifiedTypeIdent arguments)
     ;
 
 newArrayConstruction
index 5a8f03bb63aff485dbb9325c83a1c759572a3948..95c778e6b1315acc6b9832fe59e4c6145dbc8c5c 100644 (file)
@@ -38,9 +38,9 @@ class PupRoutineCreator
         pupNode.getChild(0).addChild(createNode(CharjParser.PUBLIC, "public"));
 
         pupNode.getChild(3).addChild(createNode(CharjParser.FORMAL_PARAM_STD_DECL, "FORMAL_PARAM_STD_DECL"));
-        pupNode.getChild(3).getChild(0).addChild(createNode(CharjParser.TYPE, "TYPE"));
+        pupNode.getChild(3).getChild(0).addChild(createNode(CharjParser.REFERENCE_TYPE, "REFERENCE_TYPE"));
         pupNode.getChild(3).getChild(0).getChild(0).addChild(createNode(CharjParser.QUALIFIED_TYPE_IDENT, "QUALIFIED_TYPE_IDENT"));
-        pupNode.getChild(3).getChild(0).getChild(0).getChild(0).addChild(createNode(CharjParser.IDENT, "PUP::er&"));
+        pupNode.getChild(3).getChild(0).getChild(0).getChild(0).addChild(createNode(CharjParser.IDENT, "PUP::er"));
 
         pupNode.getChild(3).getChild(0).addChild(createNode(CharjParser.IDENT, "p"));
     }