diff --git a/examples/actors/xdf/SSR.jrag b/examples/actors/xdf/SSR.jrag new file mode 100644 index 0000000000000000000000000000000000000000..51f500d6e47e727a85eb5b42a1ca1e2e2e692da6 --- /dev/null +++ b/examples/actors/xdf/SSR.jrag @@ -0,0 +1,107 @@ +/* -*-Java-*- */ + +/* + * Copyright (C) 2009 Anders Nilsson <anders.nilsson@cs.lth.se> + * + * This file is part of Actors model compiler. + */ + +import java.io.PrintStream; +import java.util.LinkedList; + +aspect SSR { + + void ASTNode.genSSR(java.io.PrintStream out) { + + } + + public void Start.genSSR(java.io.PrintStream out) { + getSpecification().genSSR(out); + } + + void Specification.genSSR(java.io.PrintStream out) { + + } + +} + +aspect StaticSchedule { + syn LinkedList ASTNode.genStaticSchedule(LinkedList l) = l; + eq Start.genStaticSchedule(LinkedList l) = getSpecification().genStaticSchedule(l); + eq Specification.genStaticSchedule(LinkedList l) { + for (int i=0; i<getNumElement(); i++) { + l = getElement(i).genStaticSchedule(l); + } + return l; + } + eq XDF.genStaticSchedule(LinkedList l) { + for (int i=0; i<getNumElement(); i++) { + l = getElement(i).genStaticSchedule(l); + } + return l; + } + eq Connection.genStaticSchedule(LinkedList l) { + Instance src = getSource(); + System.out.println(src); + return l; +// Instance dest = getDest(); + } +} + +aspect ActorLookup { + syn Instance Connection.getSource() = root().getInstance(source()); + + String Connection.source() { + for (Attribute a : getAttributes()) { + if (a instanceof src) { + return a.getAttrValue().getLITERAL(); + } + } + return ""; + } +} + +aspect misc { + syn XDF ASTNode.root() = getParent().root(); + eq XDF.root() = this; + + syn Instance ASTNode.getInstance(String s) = null; + eq ComplexElement.getInstance(String s) { + Instance inst = null; + for (Element e : getElements()){ + inst = e.getInstance(s); + if (inst!=null) { + return inst; + } + } + return null; + } + eq Instance.getInstance(String s) { + if (name().equals(s)) { + return this; + } else { + return super.getInstance(s); + } + } + + syn String ComplexElement.name() = ""; + eq Instance.name() = id(); + + String Instance.id() { + for (int i=0; i<getNumAttribute(); i++) { + Attribute a = getAttribute(i); + if (a instanceof id) { + return a.getAttrValue().getLITERAL(); + } + } + return ""; + } +} + + +aspect Fixes { + int ASTNode.numChildren; + int ASTNode.numChildren() {return jjtGetNumChildren();} + int List.getNumNoTransformChild() {return getNumChildNoTransform();} + int Opt.getNumChildNoTransfrom() {return getNumChildNoTransform();} +} \ No newline at end of file diff --git a/examples/actors/xdf/SSRAnalysis.java b/examples/actors/xdf/SSRAnalysis.java new file mode 100644 index 0000000000000000000000000000000000000000..1a7cd73e9675021ef55ff52ed83e150b6e6f4cc2 --- /dev/null +++ b/examples/actors/xdf/SSRAnalysis.java @@ -0,0 +1,10 @@ +import xdfAST.Start; + +public class SSRAnalysis extends Parser { + public static void main(String args[]) { + Start ast = parse(args); + + ast.genSSR(System.out); + } +} + diff --git a/tools/jastadd2.jar b/tools/jastadd2.jar index 2c96386291530abd4e514113a523dc9507ad35ee..46ac7b36238e16fcdf1735c4299bc5731a63f7b2 100644 Binary files a/tools/jastadd2.jar and b/tools/jastadd2.jar differ