*** empty log message ***
authorbdemsky <bdemsky>
Thu, 13 Apr 2006 00:40:20 +0000 (00:40 +0000)
committerbdemsky <bdemsky>
Thu, 13 Apr 2006 00:40:20 +0000 (00:40 +0000)
Robust/src/IR/ClassDescriptor.java
Robust/src/IR/FieldDescriptor.java
Robust/src/Lex/Keyword.java
Robust/src/Lex/Lexer.java
Robust/src/Parse/java14.cup
Robust/src/designnotes

index aae2e558d54fcbeed71d68d1fa709a05df9d19bc..504d026d818743121f04a31993f9c49837ac5468 100644 (file)
@@ -1,10 +1,6 @@
 package IR;
 import java.util.*;
 import IR.Tree.*;
-import IR.SymbolTable;
-import IR.FieldDescriptor;
-import IR.MethodDescriptor;
-import IR.NameDescriptor;
 
 public class ClassDescriptor extends Descriptor {
     public ClassDescriptor(String classname) {
@@ -24,6 +20,7 @@ public class ClassDescriptor extends Descriptor {
     Modifiers modifiers;
 
     SymbolTable fields;
+    SymbolTable flags;
     SymbolTable methods;
 
     public int getId() {
@@ -37,11 +34,19 @@ public class ClassDescriptor extends Descriptor {
     public Iterator getFields() {
        return fields.getDescriptorsIterator();
     }
+
+    public Iterator getFlags() {
+       return flags.getDescriptorsIterator();
+    }
     
     public SymbolTable getFieldTable() {
        return fields;
     }
 
+    public SymbolTable getFlagTable() {
+       return flags;
+    }
+
     public SymbolTable getMethodTable() {
        return methods;
     }
@@ -59,6 +64,16 @@ public class ClassDescriptor extends Descriptor {
        indent=TreeNode.INDENT;
        boolean printcr=false;
 
+       for(Iterator it=getFlags();it.hasNext();) {
+           FlagDescriptor fd=(FlagDescriptor)it.next();
+           st+=TreeNode.printSpace(indent)+fd.toString()+"\n";
+           printcr=true;
+       }
+       if (printcr)
+           st+="\n";
+
+       printcr=false;
+
        for(Iterator it=getFields();it.hasNext();) {
            FieldDescriptor fd=(FieldDescriptor)it.next();
            st+=TreeNode.printSpace(indent)+fd.toString()+"\n";
@@ -77,6 +92,12 @@ public class ClassDescriptor extends Descriptor {
        return st;
     }
 
+    public void addFlag(FlagDescriptor fd) {
+       if (flags.contains(fd.getSymbol()))
+           throw new Error(fd.getSymbol()+" already defined");
+       flags.add(fd);
+    }
+
     public void addField(FieldDescriptor fd) {
        if (fields.contains(fd.getSymbol()))
            throw new Error(fd.getSymbol()+" already defined");
index 41626d41721c3b3a3ca09f637c15367c85357c30..883147d84df3dd7ee602c701b0ed585cf8e76a54 100644 (file)
@@ -21,7 +21,6 @@ public class FieldDescriptor extends Descriptor {
        super(identifier);
        this.modifier=m;
        this.td=t;
-       this.identifier=identifier;
        this.en=e;
         this.safename = "___" + name + "___";
        this.uniqueid=count++;
@@ -34,8 +33,8 @@ public class FieldDescriptor extends Descriptor {
 
     public String toString() {
        if (en==null)
-           return modifier.toString()+td.toString()+" "+identifier+";";
+           return modifier.toString()+td.toString()+" "+getSymbol()+";";
        else
-           return modifier.toString()+td.toString()+" "+identifier+"="+en.printNode(0)+";";
+           return modifier.toString()+td.toString()+" "+getSymbol()+"="+en.printNode(0)+";";
     }
 }
index 4fa882cad6a28362db6fc6316add0de653611a66..9ea982e114aee051734a0bbc2370c64245594cdc 100644 (file)
@@ -64,5 +64,9 @@ class Keyword extends Token {
     key_table.put("void", new Integer(Sym.VOID));
     key_table.put("volatile", new Integer(Sym.VOLATILE));
     key_table.put("while", new Integer(Sym.WHILE));
+    //Keywords for failure aware computation
+    key_table.put("flag", new Integer(Sym.FLAG));
+    key_table.put("tag", new Integer(Sym.TAG));
+    key_table.put("task", new Integer(Sym.TASK));
   }
 }
index 2fc1a8b558bcbb4abe63b9af08b0138b45986f63..ad1a10da0ed1cf1c5b62a902e8f37f7727b36b9a 100644 (file)
@@ -251,7 +251,9 @@ public class Lexer {
     "native", "new", "package", "private", "protected", "public", 
     "return", "short", "static", "strictfp", "super", "switch",
     "synchronized", "this", "throw", "throws", "transient", "try", "void",
-    "volatile", "while" };
+    "volatile", "while", 
+    //keywords for failure aware computation
+    "flag", "tag", "task"};
   Token getIdentifier() {
     // Get id string.
     StringBuffer sb = new StringBuffer().append(consume());
index ec6c5b80a6facc1ef1ffb283e104a54098280418..f48834448050f62cbc5c9006566268122668415c 100644 (file)
@@ -103,6 +103,12 @@ terminal ASSERT; // assert_statement
 terminal ELLIPSIS;
 terminal ENUM;
 
+//failure aware computation keywords
+terminal FLAG;
+terminal TAG;
+terminal TASK;
+non terminal ParseNode flag_declaration;
+
 // 19.2) The Syntactic Grammar
 non terminal ParseNode goal;
 // 19.3) Lexical Structure
@@ -489,6 +495,11 @@ class_body_declaration ::=
 :}
        ;
 class_member_declaration ::=
+       //failure aware computation
+       flag_declaration:flag {: 
+       RESULT=(new ParseNode("flag")).addChild(flag).getRoot(); 
+       :}
+       |
        field_declaration:field {: 
        RESULT=(new ParseNode("field")).addChild(field).getRoot(); 
        :}
@@ -501,6 +512,15 @@ class_member_declaration ::=
        |       SEMICOLON       {: RESULT=new ParseNode("empty"); :}
        ;
 
+//Failure aware computation
+flag_declaration ::= 
+               FLAG IDENTIFIER:id SEMICOLON {: 
+               ParseNode pn=new ParseNode("flag_declaration");
+               pn.addChild("name").addChild(id);
+               RESULT=pn;
+       :}
+       ;
+
 // 19.8.2) Field Declarations
 field_declaration ::= 
                modifiers_opt:mo type:type variable_declarators:var SEMICOLON {: 
index 72c4ae999b2e6f8f9fc8767feda02638dab9465c..fa0367576da9893ca26c929c3dae54f8f54fa794 100644 (file)
@@ -1,6 +1,14 @@
 Objects have:
 Collection of Flags
+   Flags have type/name associated with them
+   Are either present or not present
 Collection of Tags
+   Tags have type/name associated with them   
+   Also have UID associated with them
+   Two basic types:
+     Ordered: Initial/Next / Preserves Sequencing 
+     Non-ordered: New  / Groups items together
+     
 ----------------------------------------------------------------------
 Tasks:
 Have list of parameters w/ flag/tag specifications