diff --git a/CompilerGeneration.jrag b/CompilerGeneration.jrag new file mode 100644 index 0000000000000000000000000000000000000000..aacdcbaba42babfe60c235ffdf4c7bba0be79af3 --- /dev/null +++ b/CompilerGeneration.jrag @@ -0,0 +1,23 @@ +/* -*-Java-*- */ + +import java.io.*; + +aspect CompilerGeneration { + void ASTNode.genAbsGrammar(PrintStream pStream) { + for (int i=0; i<getNumChild(); i++) { + getChild(i).genAbsGrammar(pStream); + } + } + + public void Start.genAbsGrammar(PrintStream p) { + super.genAbsGrammar(p); + } + + void OwlClass.genAbsGrammar(PrintStream pStream) { + pStream.println(getAttribute(0).getValue().getSTRING_LITERAL()); + } +} + +aspect Name { + syn String Element +} \ No newline at end of file diff --git a/GenCompiler.java b/GenCompiler.java new file mode 100644 index 0000000000000000000000000000000000000000..6ab52a888135d5b67fd02b0b570da951f224835a --- /dev/null +++ b/GenCompiler.java @@ -0,0 +1,16 @@ +// package programs; + +import AST.Start; + +public class GenCompiler extends Parser { + public static void main(String args[]) { + Start ast = parse(args); + + // Dump the AST +// ast.dumpTree(" ", System.out); + + // Should be generated to a file when sufficiently + // implemented. AndersN 060210 + ast.genAbsGrammar(System.out); + } +} \ No newline at end of file