Skip to content
Snippets Groups Projects
Commit 37d295ca authored by Anders Nilsson's avatar Anders Nilsson
Browse files

Synch

parent 7ac391bc
No related branches found
No related tags found
No related merge requests found
/* -*-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
import xdfAST.Start;
public class SSRAnalysis extends Parser {
public static void main(String args[]) {
Start ast = parse(args);
ast.genSSR(System.out);
}
}
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment