diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag index 639b4b0fe9d608b81fd7e2a17c254fe9fd647a61..676603ddabe799fadc21e8752ece0d241e417c3d 100644 --- a/CompilerGeneration.jrag +++ b/CompilerGeneration.jrag @@ -22,7 +22,6 @@ aspect AbsGrammarGeneration { pStream.println("abstract Thing : ComplexElement ::=;"); pStream.println("abstract Element;"); pStream.println("ComplexElement : Element ::= OwlIdentifier Attribute* Element*;"); -// pStream.println("ComplexElement ::= id1:OwlIdentifier id2:OwlIdentifier;"); pStream.println("abstract SimpleElement : Element;"); pStream.println("StringElement : SimpleElement ::= OwlIdentifier;"); pStream.println("IntElement : SimpleElement ::= <INTEGER_LITERAL>;"); @@ -68,9 +67,6 @@ aspect AbsGrammarGeneration { } void OwlRestriction.genAbsGrammar(PrintStream pStream) { -// pStream.print(getRestrictionClassId().substring(0,1).toLowerCase()+ -// getRestrictionClassId().substring(1)); -// pStream.print(":"); pStream.print(name()); if (allValuesFrom()) { pStream.print("*"); @@ -177,14 +173,11 @@ aspect GenRewrites { pStream.println(ind(2)+"when (getOwlIdentifier().getIDENTIFIER().equals(\""+ name()+"\") && !(this instanceof Thing))"); pStream.println(ind(3)+"to "+name()+" {"); -// pStream.println(ind(3)+"System.out.println(\"rewriting: \"+getOwlIdentifier().getIDENTIFIER());"); + pStream.println(ind(3)+name()+" node = new "+name()+"();"); pStream.println(ind(3)+"node.setOwlIdentifier(getOwlIdentifier());"); pStream.println(ind(3)+"node.setAttributeList(getAttributeList());"); pStream.println(ind(3)+"node.setElementList(getElementList());"); - // Very temporary solution just so that DumpTree will not - // crasch from NullPointerException. Children should be filled - // in from rewrites instead Restrictions restr = getRestrictions(); pStream.println(ind(3)+"List l;"); for (int i=0; i<restr.getNumOwlRestriction(); i++) { @@ -197,7 +190,6 @@ aspect GenRewrites { pStream.println(ind(3)+"}"); if (r.allValuesFrom()) { pStream.println(ind(3)+"node.set"+r.name()+"List(l);"); -// pStream.println(ind(3)+"node.set"+r.name()+"List(new List());"); } else { pStream.println(ind(3)+r.name()+" c"+ix+" = new "+r.name()+"();"); pStream.println(ind(3)+"node.set"+r.name()+"(c"+(ix++)+");"); diff --git a/GenCompiler.java b/GenCompiler.java index 1dcf3afdd7c990223affee53f424ac07050a3518..39dca6e7a2e43bf881feb8bedbf487923e92f0f7 100644 --- a/GenCompiler.java +++ b/GenCompiler.java @@ -14,10 +14,6 @@ public class GenCompiler extends Parser { public static void main(String args[]) { Start ast = parse(args); - // Dump the AST -// ast.dumpTree(" ", System.out); - - File siarasDir = new File("siaras"); if (!siarasDir.isDirectory()) { siarasDir.mkdir(); @@ -30,11 +26,6 @@ public class GenCompiler extends Parser { PrintStream pStream = new PrintStream(new File(fileName)); ast.genAbsGrammar(pStream); - // Generate JavaCC configuration -// fileName = "siaras/Siaras.jjt"; -// pStream = new PrintStream(new File(fileName)); -// ast.genJavaCC(pStream); - // Generate Parser.java fileName = "siaras/Parser.java"; pStream = new PrintStream(new File(fileName)); @@ -44,13 +35,7 @@ public class GenCompiler extends Parser { fileName = "siaras/GeneratedAspects.jrag"; pStream = new PrintStream(new File(fileName)); ast.genAspects(pStream); -// ast.genRewrites(pStream); -// ast.genPrettyPrinter("",pStream); - // Generate PrettyPrinter -// fileName = "siaras/PrettyPrinter.jrag"; -// pStream = new PrintStream(new File(fileName)); -// ast.genPrettyPrinter("",pStream); } catch (java.io.FileNotFoundException e) { System.out.println("Could not create file: "+fileName); e.printStackTrace();