Package AGEval

Examples of AGEval.InvalidGrammarException


      try {
        if (propClean.contains("_init") || propClean.contains("_last")) { //loop vars
          isParseData = false;
        } else {
          ExtendedVertex v = Generator.extendedGet(ast, cls, lhs.replace("$$", "").replace("$i", "").replace("$-", ""));         
          if (v.isInput) throw new InvalidGrammarException("Accessing parse data as lhs: " + cls.getName() + "::" + lhs);
          else isParseData = false;
        }
      } catch (InvalidGrammarException e) {
        e.printStackTrace();
        isParseData = false;
View Full Code Here


                "#else\n" +
                "  p.batch(v" + pass + ");\n" +
                "#endif\n";
        lockC++;
      } else {
        throw new InvalidGrammarException("Unknown stencil type: " + stencil);
      }
      res += "#ifdef DEBUGY\n  cout << \"  (batch done.)\" << endl;\n#endif //DEBUGY\n";
      pass++;
      res +=
          "#ifdef DEBUGY\nt" + pass + " = tbb::tick_count::now();\n#endif //DEBUGY\n";     
View Full Code Here

          "#else\n" +
          "  p.batchP(v" + pass + ");\n" +
          "#endif\n";
        lockC++;
    } else {
      throw new InvalidGrammarException("Unknown stencil type: " + stencil);
    }
    res += "#ifdef DEBUGY\n  cout << \"  (batch done.)\" << endl;\n#endif //DEBUGY\n";
    pass++;
    res +=
      "#ifdef DEBUGY\nt" + pass + " = tbb::tick_count::now();\n#endif // DEBUGY\n";     
View Full Code Here

        "#else\n" +
        "  ??\n" +
        "#endif\n";
      lockC++;
    } else {
      throw new InvalidGrammarException("Unknown stencil type: " + stencil);
    }
    pass++;
   
  }     
  return res;   
View Full Code Here

        "#else\n" +
        "  ??\n" +
        "#endif\n";
      lockC++;
    } else {
      throw new InvalidGrammarException("Unknown stencil type: " + stencil);
    }
    pass++;   
   
  }     
  return res;
View Full Code Here

        "#else\n" +
        "  ??\n" +
        "#endif\n";
      lockC++;
    } else {
      throw new InvalidGrammarException("Unknown stencil type: " + stencil);
    }
    pass++;
   
  }     
  return res;
View Full Code Here

      if (isParent) {
        return "computeData.classData.Sub" + cls.getName() + "." + cleanProp;           
      } else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
        return "computeData.classData.Sub" + cls.getName() + "." + child.toLowerCase() + "_" + cleanProp + "_last";           
      } else {
        throw new InvalidGrammarException("Cannot access $$ attrib of a non-multi child / self reduction: " + lhs)
      }
    } else if (prop.contains("$i")) {
      //throw new InvalidGrammarException("$i not handled in C++ backend yet");
      //System.err.println("$i not handled in C++ backend yet");
      if (isParent) {
        throw new InvalidGrammarException("Cannot access $i of self attrib: " + lhs);
        //return "computeData.classData.Sub" + cls.getName() + "." + cleanProp;    
      } else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
        if (isParseData) {         
          if (cleanProp.equals("display")) return "loopChild->data.parseData.display";
          else return "loopChild->data.parseData.genData.extraParse" + cls.getChildByName(child).getName() + ".fld_" + cleanProp;
        }
        else return "loopChild->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;       
      } else {
        throw new InvalidGrammarException("Cannot access $i attrib of a non-multi child: " + lhs);
        //return "parseFloat(getChildByRefName(node,\"" + child + "\").getAttribute(\"" + cleanProp + "\"))"; 
      }         
    } else if (prop.contains("$-")) {
      if (isParent) {
        //by definition, cannot be parse data (for now..)
        //FIXME check sink is scheduled in same loop
        return "computeData.classData.Sub" + cls.getName() + "." + cleanProp;
      } else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
        String init = "computeData.classData.Sub" + cls.getName() + "." + child.toLowerCase() + "_" + cleanProp + "_init";
        String step = "(PREV())->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;
        return "(STEP() == 1 ? (" + init + ") : (" + step + "))";
        //return "(PREV())->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;
        //return " parseFloat((i == 0 ? node.getAttribute(\"" + child.toLowerCase() + "_" + cleanProp + "_init\")" + " : children[i-1].getAttribute(\"" + cleanProp + "\")))";
      } else {
        throw new InvalidGrammarException("Cannot access $- attrib of a non-multi child: " + lhs);
        //by definition, cannot be parse data (for now..)
//        System.err.println("check cpp prev child iter name"); //FIXME
//        String init = "computeData.classData.Sub" + cls.getName() + "." + cleanProp + "_init";
//        String cur = "(loopChild - 1)->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;
//        return "(i == 0 ? " + init + " : " + cur + ")";
View Full Code Here

  res += "cout << \"" + space +  msg + ": \" << " + rhs + " << endl;\n";
  return res + "#endif //DEBUGY\n";
}
public String logStmtVar(int indentSrc, int indentOut, String msg, ALEParser ast, AGEval.Class cls, String rhs, String rhsAddress) throws InvalidGrammarException {
  ExtendedVertex v = Generator.lookupAttributeExtended(rhs, cls, ast);
  if (v == null) throw new InvalidGrammarException("logStmtVar cpp: could not find " + cls.getName() + "::" + rhs);
  boolean isMaybe = v.isMaybeType;
  boolean isString = v.strType.equals("string");

  String indent = "";
  for (int i = 0; i < indentSrc; i++) indent += " ";
View Full Code Here

      }
     
     
      String trav;
      if (stencil.equals("tdLtrU")) {
        throw new InvalidGrammarException("Cannot codegen recursive trav for WebCL");
      } else if (stencil.equals("td")) trav = "topDown";
      else if (stencil.equals("bu")) trav = "bottomUp";
      else if (stencil.equals("buSubInorder")) {
        throw new InvalidGrammarException("Cannot codegen nested trav for WebCL");
      }
      else throw new InvalidGrammarException("Unknown stencil type: " + stencil);
     
      contents.append("\tthis.");
      contents.append(trav);
      contents.append("Traversal(this._gen_kernel_visit_");
      contents.append(pass);
View Full Code Here

      if (isParent) {
        return fields.findCppField(cls, cleanProp).getCppRhsName() + "[index]";
      } else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
        return fields.findCppField(cls, child + "_" + cleanProp + "_last").getCppRhsName() + "[index]";
      } else {
        throw new InvalidGrammarException("Cannot access $$ attrib of a non-multi child / self reduction: "
            + lhs);
      }
      // $i means access the current iteration of a loop
    } else if (prop.contains("$i")) { // We're working with a multi child
      if (isParent) {
        throw new InvalidGrammarException("Cannot access $i of self attrib: " + lhs);
      } else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
        AGEval.IFace child_class = cls.getChildByName(child);
       
        return fields.findCppField(child_class, cleanProp).getCppRhsName() + "[current_node]";
      } else {
        throw new InvalidGrammarException("Cannot access $i attrib of a non-multi child: " + lhs);
      }
      // $- means access the previous iteration of the loop
    } else if (prop.contains("$-")) {
      if (isParent) {
        return fields.findCppField(cls, cleanProp).getCppRhsName() + "[index]";
      } else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
        String init = fields.findCppField(cls, child + "_" + cleanProp + "_last").getCppRhsName() + "[index]";
        String rest = fields.findCppField(cls.getChildByName(child), cleanProp).getCppRhsName() + "[PREV_FLATCPP()]";
        return "(STEP() == 1 ? (" + init + ") : (" + rest + "))";
      } else {
        throw new InvalidGrammarException("Cannot access $- attrib of a non-multi child: " + lhs);
      }
      // We're just working with regular variables
    } else {
      if (isParent) {
        return fields.findCppField(cls, cleanProp).getCppRhsName() + "[index]";
View Full Code Here

TOP

Related Classes of AGEval.InvalidGrammarException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.