Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Anders Nilsson
OwlCompiler
Commits
1da31eb4
Commit
1da31eb4
authored
Dec 10, 2006
by
Anders Nilsson
Browse files
Synching. Doesn't compile
parent
bfe1842b
Changes
2
Hide whitespace changes
Inline
Side-by-side
CompilerGeneration.jrag
View file @
1da31eb4
...
...
@@ -27,6 +27,7 @@ aspect AbsGrammarGeneration {
pStream.println("StringElement : SimpleElement ::= <IDENTIFIER>;");
pStream.println("IntElement : SimpleElement ::= <INTEGER_LITERAL>;");
pStream.println("FloatElement : SimpleElement ::= <FLOAT_LITERAL>;");
pStream.println("abstract ClassUse : ComplexElement ::= /decl:Thing/;");
pStream.println("Attribute ::= Value;");
pStream.println("RdfDatatype : Attribute ::= ;");
pStream.println("RdfId : Attribute ::= ;");
...
...
@@ -58,6 +59,9 @@ aspect AbsGrammarGeneration {
pStream.print(" ::=");
getOwnRestrictions().genAbsGrammar(pStream);
pStream.println(";");
pStream.print(getId()+"Use");
pStream.print(" : ClassUse");
pStream.println(";");
}
void Restrictions.genAbsGrammar(PrintStream pStream) {
...
...
@@ -251,8 +255,16 @@ aspect GenRewrites {
pStream.println(ind(3)+"return node;");
pStream.println(ind(2)+"}");
pStream.println(ind(1)+"}");
pStream.println();
// Rearrange device nodes on the AST to get away from the
// 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 {
pStream.println(ind(1)+"eq StringElement.value() = getIDENTIFIER();");
pStream.println(ind(1)+"eq IntElement.value() = getINTEGER_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);
pStream.println("}");
}
...
...
siaras/build.xml
View file @
1da31eb4
...
...
@@ -6,7 +6,7 @@
gen - generates java 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 -->
<property
name=
"package"
value=
"AST"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment