Merge branch 'charm' of charmgit:charm into charm
authorChao Mei <chaomei2@illinois.edu>
Thu, 27 May 2010 16:33:34 +0000 (11:33 -0500)
committerChao Mei <chaomei2@illinois.edu>
Thu, 27 May 2010 16:33:34 +0000 (11:33 -0500)
src/langs/charj/src/charj/translator/Charj.g
src/langs/charj/src/charj/translator/Charj.stg
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/SymbolTable.java
src/langs/charj/tests/unit/Main.cj [new file with mode: 0644]

index 5dfc8f4d294dc4fb68613ea2ea970385b6724dc3..aa940a08d73243dc4d4f05bc91b2f33ce52a4a59 100644 (file)
@@ -177,6 +177,7 @@ tokens {
     OBJECT_TYPE;
     REFERENCE_TYPE;
     POINTER_TYPE;
+    PROXY_TYPE;
     PRIMITIVE_VAR_DECLARATION;
     OBJECT_VAR_DECLARATION;
     VAR_DECLARATOR;
@@ -402,9 +403,15 @@ localModifier
 type
     :   simpleType
     |   objectType
+    |   proxyType
     |   VOID
     ;
 
+proxyType
+    :   qualifiedTypeIdent '@' arrayDeclaratorList?
+        ->  ^(PROXY_TYPE qualifiedTypeIdent arrayDeclaratorList?)
+    ;
+
 simpleType
     :   primitiveType arrayDeclaratorList?
         ->  ^(SIMPLE_TYPE primitiveType arrayDeclaratorList?)  
index a810e3db533413966230ba970d40c6d0c1f6ad58..18363b1b11e844c8505901eea0ed7b5cd4ff1f4b 100644 (file)
@@ -38,7 +38,7 @@ charjSource_cc(basename, pd, ids, tds, debug) ::=
 
 >>
 
-importDeclaration_cc_h(inc_id, use_id) ::= 
+importDeclaration_cc_h(inc_id, use_id) ::=
 <<
 #include \<<inc_id>\>
 using <use_id>;
@@ -189,13 +189,13 @@ entry void<gtpl> <id><fpl>;
 
 ctorDecl_h(modl, gtpl, id, fpl, block) ::=
 <<
-<if(modl)><modl>:<endif><gtpl> <id><fpl>;
+<if(modl)><modl; separator=" ">: <endif><id><fpl>;
 >>
 
 
 ctorDecl_cc(modl, gtpl, id, fpl, block) ::=
 <<
-<gtpl> <id>::<id><fpl>
+<id>::<id><fpl>
 <block>
 >>
 
@@ -256,7 +256,7 @@ local_mod_list(mods) ::=
 <<
 <if(mods)><mods; separator=" "><endif>
 >>
+
 
 local_var_decl(modList, type, declList) ::=
 <<
@@ -279,6 +279,11 @@ obj_type(typeID, arrDeclList) ::=
 <typeID><arrDeclList>
 >>
 
+proxy_type(typeID, arrDeclList) ::=
+<<
+CProxy_<typeID><arrDeclList>
+>>
+
 pointer_type(typeID, arrDeclList) ::=
 <<
 <typeID>*<arrDeclList>
@@ -391,7 +396,7 @@ array_construction_with_init(array_decls, initializer) ::=
 array_construction(exprs, array_decls) ::=
 <<
 [<exprs; separator="][">]<array_decls>
->> 
+>>
 
 
 arguments(exprs) ::=
index a87844470257df290ec4eaa44df1fecb69dfa29b..6c46e60e151a2697dc6e14a32eb3ed9a34548022 100644 (file)
@@ -73,6 +73,7 @@ chareType
     :   CHARE
     |   GROUP
     |   NODEGROUP
+    |   MAINCHARE
     |   ^(CHARE_ARRAY ARRAY_DIMENSION)
     ;
 
@@ -176,6 +177,7 @@ simpleType
     
 objectType
     :   ^(OBJECT_TYPE qualifiedTypeIdent arrayDeclaratorList?)
+    |   ^(PROXY_TYPE qualifiedTypeIdent arrayDeclaratorList?)
     |   ^(REFERENCE_TYPE qualifiedTypeIdent arrayDeclaratorList?)
     |   ^(POINTER_TYPE qualifiedTypeIdent arrayDeclaratorList?)
     ;
index 81353f56b630147d7ab9280d2e9bbdb0994e839a..4465191c9e381a94eb4931dd3ca71eee9e5de26e 100644 (file)
@@ -194,9 +194,10 @@ classScopeDeclaration
             if ($m.st != null) {
                 // determine whether this is an entry method
                 entry = listContainsToken($m.start.getChildren(), ENTRY);
-                for(Object o : $m.names)
-                  if(o.equals("entry")) continue;
-                  else modList.add(o.toString());
+                for(Object o : $m.names) {
+                    if (o.equals("entry")) continue;
+                    else modList.add(o.toString());
+                }
             }
         }
         -> {emitCC()}? funcMethodDecl_cc(
@@ -242,22 +243,26 @@ classScopeDeclaration
             // determine whether this is an entry method
             if ($m.st != null) {
                 entry = listContainsToken($m.start.getChildren(), ENTRY);
+                for(Object o : $m.names) {
+                    if (o.equals("entry")) continue;
+                    else modList.add(o.toString());
+                }
             }
         }
         -> {emitCC()}? ctorDecl_cc(
-                modl={$m.st}, 
+                modl={modList},
                 gtpl={$g.st}, 
                 id={$IDENT.text}, 
                 fpl={$f.st}, 
                 block={$b.st})
         -> {emitCI() && entry}? ctorDecl_ci(
-                modl={$m.st}, 
+                modl={modList},
                 gtpl={$g.st}, 
                 id={$IDENT.text}, 
                 fpl={$f.st}, 
                 block={$b.st})
         -> {emitH()}? ctorDecl_h(
-                modl={$m.st}, 
+                modl={modList},
                 gtpl={$g.st}, 
                 id={$IDENT.text}, 
                 fpl={$f.st}, 
@@ -384,6 +389,8 @@ simpleType
 objectType
     :   ^(OBJECT_TYPE qualifiedTypeIdent arrayDeclaratorList?)
         -> obj_type(typeID={$qualifiedTypeIdent.st}, arrDeclList={$arrayDeclaratorList.st})
+    |   ^(PROXY_TYPE qualifiedTypeIdent arrayDeclaratorList?)
+        -> proxy_type(typeID={$qualifiedTypeIdent.st}, arrDeclList={$arrayDeclaratorList.st})
     |   ^(POINTER_TYPE qualifiedTypeIdent arrayDeclaratorList?)
         -> pointer_type(typeID={$qualifiedTypeIdent.st}, arrDeclList={$arrayDeclaratorList.st})
     |   ^(REFERENCE_TYPE qualifiedTypeIdent arrayDeclaratorList?)
index de5798eedd01162a658a55d8e642eb6300959c1c..1531a0f3d8062cb4648123be8a9ac09f23e31f96 100644 (file)
@@ -107,7 +107,6 @@ packageDeclaration
             }
             currentPackage = ps;
             $ScopeStack::current = ps;
-//            $qualifiedIdentifier.start.symbol = ps; ----- commented out while dealing with the namespaces issue (Minas)
         }
     ;
     
@@ -280,6 +279,7 @@ simpleType returns [ClassSymbol type]
 objectType returns [ClassSymbol type]
     :   ^(OBJECT_TYPE qualifiedTypeIdent arrayDeclaratorList?)
     |   ^(REFERENCE_TYPE qualifiedTypeIdent arrayDeclaratorList?)
+    |   ^(PROXY_TYPE qualifiedTypeIdent arrayDeclaratorList?)
     |   ^(POINTER_TYPE qualifiedTypeIdent arrayDeclaratorList?)
         {
             $type = currentClass.resolveType($qualifiedTypeIdent.name);
index 3812e3e6fbd5aeeb3e8febf11b3f611b04774016..fdec096a69db0b6964e6412570099b3aead5d36e 100644 (file)
@@ -56,7 +56,6 @@ public class SymbolTable {
     {
         PackageScope lang = resolvePackage("charj.lang");
         objectRoot = new ClassSymbol(this, "Object", null, lang);
-        objectRoot.define("EOF", new VariableSymbol(this,"EOF",null));
         lang.define("Object", objectRoot);
 
         primitiveTypes.put("void",   new ClassSymbol(this, "void",   null, lang));
diff --git a/src/langs/charj/tests/unit/Main.cj b/src/langs/charj/tests/unit/Main.cj
new file mode 100644 (file)
index 0000000..e42dc45
--- /dev/null
@@ -0,0 +1,13 @@
+
+package tests.unit;
+
+mainchare Main {
+    public entry Main() {
+    }
+
+    public entry void run_tests() {
+    }
+
+    public entry void confirm_result(boolean result) {
+    }
+}