Charj : added basic syntax support for array section creation
authorMinas Charalambides <charala1@illinois.edu>
Sat, 18 Sep 2010 20:52:43 +0000 (15:52 -0500)
committerMinas Charalambides <charala1@illinois.edu>
Sat, 18 Sep 2010 20:52:43 +0000 (15:52 -0500)
note: syntax is recognized, but actual functionality is
not yet available

src/langs/charj/src/charj/translator/Charj.g
src/langs/charj/src/charj/translator/CharjASTModifier.g
src/langs/charj/src/charj/translator/CharjASTModifier2.g
src/langs/charj/src/charj/translator/CharjEmitter.g

index 217f73044e0c8f979f62654821b31ee5ade8d6fc..9576c3876e2836bb4cd8fe489fcdc6eda83c6985 100644 (file)
@@ -222,6 +222,8 @@ tokens {
     REFERENCE_TYPE;
     POINTER_TYPE;
     PROXY_TYPE;
+       ARRAY_SECTION_TYPE;
+       ARRAY_SECTION;
     PRIMITIVE_VAR_DECLARATION;
     OBJECT_VAR_DECLARATION;
     VAR_DECLARATOR;
@@ -490,6 +492,8 @@ constructorType
         ->  ^(PROXY_TYPE qualifiedTypeIdent domainExpression?)
     |   qualifiedTypeIdent domainExpression?
         ->  ^(OBJECT_TYPE qualifiedTypeIdent domainExpression?)
+       |       MOD qualifiedTypeIdent AT domainExpression
+               ->      ^(ARRAY_SECTION_TYPE qualifiedTypeIdent domainExpression)
     ;
 
 simpleType
@@ -502,6 +506,8 @@ objectType
         ->  ^(PROXY_TYPE qualifiedTypeIdent domainExpression?)
     |   qualifiedTypeIdent domainExpression?
         ->  ^(POINTER_TYPE qualifiedTypeIdent domainExpression?)
+       |       MOD qualifiedTypeIdent AT
+               ->      ^(ARRAY_SECTION_TYPE qualifiedTypeIdent)
     ;
 
 qualifiedTypeIdent
@@ -961,13 +967,13 @@ qualifiedIdentExpression
     ;
 
 newExpression
-    :   n=NEW
+    :   NEW
         (
             domainExpression arguments?
             ->  ^(NEW_EXPRESSION arguments? domainExpression)
         |   constructorType arguments
             -> ^(NEW constructorType arguments)
-        )
+               )
     ;
     
 /*newArrayConstruction
index 4851432076c4ee9dac92862a888b4d658aa781d3..b799727d84e666010a0ae886508821810a66fab7 100644 (file)
@@ -250,12 +250,7 @@ objectType
     |   ^(PROXY_TYPE qualifiedTypeIdent domainExpression?)
     |   ^(REFERENCE_TYPE qualifiedTypeIdent domainExpression?)
     |   ^(POINTER_TYPE qualifiedTypeIdent domainExpression?)
-        {
-            // TODO: This breaks all pointer types inside chares not used for sending
-            // them in entry methods, converting them to object types, which breaks
-            // Arrays inside chares.
-            //astmod.dealWithEntryMethodParam($POINTER_TYPE, $POINTER_TYPE.tree);
-        }
+       |       ^(ARRAY_SECTION_TYPE qualifiedTypeIdent domainExpression?)
     ;
 
 qualifiedTypeIdent
index 89adb2dc778dd91e3f0312ab412bbb4f89019f71..d424cbd4686f675e7a74ed3c9b3da30ef5c50a89 100644 (file)
@@ -242,6 +242,7 @@ objectType returns [ClassSymbol type]
     |   ^(REFERENCE_TYPE qualifiedTypeIdent domainExpression?)
     |   ^(PROXY_TYPE qualifiedTypeIdent domainExpression?)
     |   ^(POINTER_TYPE qualifiedTypeIdent domainExpression?)
+       |       ^(ARRAY_SECTION_TYPE qualifiedTypeIdent domainExpression?) // TODO deal with it!!
     ;
 
 entryArgObjectType returns [ClassSymbol type]
index 0f8562f059fff402e316f9ed8f9946040474a17c..3631e0b7836b7ca9a2406eeb2d3dacd083aa29f2 100644 (file)
@@ -569,6 +569,8 @@ nonProxyType
 proxyType
     :   ^(PROXY_TYPE qualifiedTypeIdent domainExpression[null]?)
         -> proxy_type(typeID={$qualifiedTypeIdent.st}, arrDeclList={$domainExpression.st})
+       |       ^(ARRAY_SECTION_TYPE qualifiedTypeIdent domainExpression[null]?) // TODO array sections
+               -> template() "not implemented yet"
     ;
 
 qualifiedTypeIdent returns [ClassSymbol type]
@@ -984,7 +986,7 @@ newExpression[StringTemplate obtype]
     :   ^(NEW_EXPRESSION arguments? domainExpression[$arguments.args])
         -> template(domain={$domainExpression.st},type={$obtype}) "new <type>(<domain>)"
     |   ^(NEW proxyType arguments)
-        -> template(t={$proxyType.st}, a={$arguments.st}) "<t>::ckNew(<a>)"
+        -> template(t={$proxyType.st}, a={$arguments.st}) "<t>::ckNew(<a>)" // TODO array sections
     |   ^(NEW nonProxyType arguments)
         -> template(q={$nonProxyType.st}, a={$arguments.st}) "new <q>(<a>)"
     ;