Commit 1da31eb4 authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Synching. Doesn't compile

parent bfe1842b
...@@ -27,6 +27,7 @@ aspect AbsGrammarGeneration { ...@@ -27,6 +27,7 @@ aspect AbsGrammarGeneration {
pStream.println("StringElement : SimpleElement ::= <IDENTIFIER>;"); pStream.println("StringElement : SimpleElement ::= <IDENTIFIER>;");
pStream.println("IntElement : SimpleElement ::= <INTEGER_LITERAL>;"); pStream.println("IntElement : SimpleElement ::= <INTEGER_LITERAL>;");
pStream.println("FloatElement : SimpleElement ::= <FLOAT_LITERAL>;"); pStream.println("FloatElement : SimpleElement ::= <FLOAT_LITERAL>;");
pStream.println("abstract ClassUse : ComplexElement ::= /decl:Thing/;");
pStream.println("Attribute ::= Value;"); pStream.println("Attribute ::= Value;");
pStream.println("RdfDatatype : Attribute ::= ;"); pStream.println("RdfDatatype : Attribute ::= ;");
pStream.println("RdfId : Attribute ::= ;"); pStream.println("RdfId : Attribute ::= ;");
...@@ -58,6 +59,9 @@ aspect AbsGrammarGeneration { ...@@ -58,6 +59,9 @@ aspect AbsGrammarGeneration {
pStream.print(" ::="); pStream.print(" ::=");
getOwnRestrictions().genAbsGrammar(pStream); getOwnRestrictions().genAbsGrammar(pStream);
pStream.println(";"); pStream.println(";");
pStream.print(getId()+"Use");
pStream.print(" : ClassUse");
pStream.println(";");
} }
void Restrictions.genAbsGrammar(PrintStream pStream) { void Restrictions.genAbsGrammar(PrintStream pStream) {
...@@ -251,8 +255,16 @@ aspect GenRewrites { ...@@ -251,8 +255,16 @@ aspect GenRewrites {
pStream.println(ind(3)+"return node;"); pStream.println(ind(3)+"return node;");
pStream.println(ind(2)+"}"); pStream.println(ind(2)+"}");
pStream.println(ind(1)+"}"); pStream.println(ind(1)+"}");
pStream.println();
// Rearrange device nodes on the AST to get away from the // Rearrange device nodes on the AST to get away from the
// current diagonal style from Protege // current diagonal style from Protege
pStream.println(ind(1)+"rewrite "+name()+" {");
pStream.println(ind(2)+"when (!isTopElement())");
pStream.println(ind(2)+"to "+name()+"Use {");
pStream.println(ind(3)+"getStart().addElement(this);");
pStream.println(ind(3)+"return new "+name()+"Use();");
pStream.println(ind(2)+"}");
pStream.println(ind(1)+"}");
} }
} }
...@@ -282,6 +294,19 @@ aspect GenMisc { ...@@ -282,6 +294,19 @@ aspect GenMisc {
pStream.println(ind(1)+"eq StringElement.value() = getIDENTIFIER();"); pStream.println(ind(1)+"eq StringElement.value() = getIDENTIFIER();");
pStream.println(ind(1)+"eq IntElement.value() = getINTEGER_LITERAL();"); pStream.println(ind(1)+"eq IntElement.value() = getINTEGER_LITERAL();");
pStream.println(ind(1)+"eq FloatElement.value() = getFLOAT_LITERAL();"); pStream.println(ind(1)+"eq FloatElement.value() = getFLOAT_LITERAL();");
pStream.println(ind(1)+"boolean Thing.isTopElement() {");
pStream.println(ind(2)+"return getParent().getParent() instanceof Start;");
pStream.println(ind(1)+"}");
pStream.println(ind(1)+"Start ASTNode.getStart() {");
pStream.println(ind(2)+"return getParent().getStart();");
pStream.println(ind(1)+"}");
pStream.println(ind(1)+"Start Start.getStart() {");
pStream.println(ind(2)+"return this;");
pStream.println(ind(1)+"}");
super.genMisc(pStream); super.genMisc(pStream);
pStream.println("}"); pStream.println("}");
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
gen - generates java files gen - generates java files
genClean - removes all generated files and their class files genClean - removes all generated files and their class files
--> -->
<project name="Java1.4Frontend" default="build" basedir="."> <project name="OntologyCompiler" default="build" basedir=".">
<!-- "package" is the directory where generated files will be stored --> <!-- "package" is the directory where generated files will be stored -->
<property name="package" value="AST"/> <property name="package" value="AST"/>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment