Skip to content
Snippets Groups Projects
Commit 1c945a6e authored by Sebastian Ebert's avatar Sebastian Ebert
Browse files

initial merge state

parents d740a665 d79785b9
Branches
No related tags found
1 merge request!11Merge/dev to fork master merge
Showing
with 467 additions and 0 deletions
aspect Computation {
// native types, synthesized
syn String NativeTypes.getWriteIntValue() = getDriver();
syn String NativeTypes.getWriteShortValue() = getDriver();
syn String NativeTypes.getWriteLongValue() = getDriver();
syn String NativeTypes.getWriteFloatValue() = getDriver();
syn String NativeTypes.getWriteDoubleValue() = getDriver();
syn String NativeTypes.getWriteCharValue() = getDriver();
syn String NativeTypes.getWriteBooleanValue() = getDriver();
}
A ::= NativeTypes BoxedTypes ;
NativeTypes ::= <IntValue:int> <ShortValue:short> <LongValue:long> <FloatValue:float> <DoubleValue:double> <CharValue:char> <BooleanValue:boolean> <Driver:String> /<WriteIntValue:String>/ /<WriteShortValue:String>/ /<WriteLongValue:String>/ /<WriteFloatValue:String>/ /<WriteDoubleValue:String>/ /<WriteCharValue:String>/ /<WriteBooleanValue:String>/;
BoxedTypes ::= <IntValue:Integer> <ShortValue:Short> <LongValue:Long> <FloatValue:Float> <DoubleValue:Double> <CharValue:Character> <BooleanValue:Boolean> ;
/*.noNewLine.*
# Issue27
Regression test for failing parser when missing newline at end of specification.
receive A.Name ;
A ::= <Name:String> ;
# Single List
Idea: send and receive single values for lists of subtrees.
Once without incremental evaluation (i.e., using manual dependencies), and the other time with incremental evaluation
## Execution-Model
```
SenderRoot ReceiverRoot
|- A1 --( a/1 ) --\ |
|- A2 --( a/2 ) --+=\ /--> A* --------------|
|- A3 --( a/3 ) ----+==+--> WithAdd:A* ------|
|- A4 --( a/4 ) --+=/ |
|- IO --( a/5 ) --/ |
/--> UsingWc:A* ------|
( a/# ) -+--> UsingWcWithA:A* -|
```
## Computation
A _n_ = Input _n_ + 1, e.g., A1 = Input1 + 1
## Execution-Trace (SendInitialValue)
| Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A |
|---|---|---|---|---|---|---|
| * | [1,2,3,4,0] | 5 | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] |
| I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] |
| I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] |
| I1:2 | [3,2,3,4,0] | 7 | [3,2,3,4,0] | [3,2,3,4,0] | [1,2,3,4,0,2,3] | [1,2,3,4,0,2,3] |
| IO:5 | [3,2,3,4,5] | 8 | [3,2,3,4,5] | [3,2,3,4,5] | [1,2,3,4,0,2,3,5] | [1,2,3,4,0,2,3,5]
| I3:4 | [3,2,7,4,5] | 9 | [3,2,7,4,5] | [3,2,7,4,5] | [1,2,3,4,0,2,3,5,7] | [1,2,3,4,0,2,3,5,7] |
*: (1:0, 2:0, 3:0, 4:0, 5:0)
## Execution-Trace (OnlyUpdate)
| Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A |
|---|---|---|---|---|---|---|
| * | [-,-,-,-,-] | 0 | [0,0,0,0,0] | [] | [] | [] |
| I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] |
| I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] |
| I1:2 | [3,-,-,-,-] | 2 | [3,0,0,0,0] | [3] | [2,3] | [2,3] |
| IO:5 | [2,-,-,-,5] | 3 | [3,0,0,0,5] | [3,5] | [2,3,5] | [2,3,5]
| I3:4 | [2,-,7,-,5] | 4 | [3,0,7,0,5] | [3,5,7] | [2,3,5,7] | [2,3,5,7] |
*: (1:0, 2:0, 3:0, 4:0, 5:0)
send tree SenderRoot.A1 ;
send tree SenderRoot.A2 ;
send tree SenderRoot.A3 ;
send tree SenderRoot.A4 ;
send SenderRoot.InOutput using IntToA ;
receive tree ReceiverRoot.A ;
receive tree ReceiverRoot.UsingWildcardA ;
receive tree with add ReceiverRoot.WithAddA ;
receive tree with add ReceiverRoot.UsingWildcardWithAddA ;
IntToA maps int i to A {:
return new A().setID(i);
:}
aspect Computation {
syn A SenderRoot.getA1() = new A().setID(getInput1() + 1);
syn A SenderRoot.getA2() = new A().setID(getInput2() + 2);
syn A SenderRoot.getA3() = new A().setID(getInput3() + 3);
syn A SenderRoot.getA4() = new A().setID(getInput4() + 4);
syn boolean ASTNode.isNameable() = false;
eq Nameable.isNameable() = true;
}
aspect Testing {
class SenderRoot implements org.jastadd.ragconnect.tests.singleList.AbstractSingleListTest.TestWrapperSenderRoot {}
class ReceiverRoot implements org.jastadd.ragconnect.tests.singleList.AbstractSingleListTest.TestWrapperReceiverRoot {}
class A implements org.jastadd.ragconnect.tests.singleList.AbstractSingleListTest.TestWrapperA {}
class JastAddList<T> implements org.jastadd.ragconnect.tests.singleList.AbstractSingleListTest.TestWrapperJastAddList<T> {}
}
aspect NameResolution {
// overriding customID guarantees to produce the same JSON representation for equal lists
// otherwise, the value for id is different each time
@Override
protected String Nameable.customID() {
return getClass().getSimpleName() + getID();
}
}
Root ::= SenderRoot* ReceiverRoot* ;
Nameable ::= <ID:int> ;
SenderRoot : Nameable ::= <Input1:int> /A1:A/
<Input2:int> /A2:A/
<Input3:int> /A3:A/
<Input4:int> /A4:A/
<InOutput:int> ;
ReceiverRoot : Nameable ::= A* UsingWildcardA:A* WithAddA:A* UsingWildcardWithAddA:A* ;
A : Nameable ;
SenderRoot.A1 canDependOn SenderRoot.Input1 as InputDependencyToA1 ;
SenderRoot.A2 canDependOn SenderRoot.Input2 as InputDependencyToA2 ;
SenderRoot.A3 canDependOn SenderRoot.Input3 as InputDependencyToA3 ;
SenderRoot.A4 canDependOn SenderRoot.Input4 as InputDependencyToA4 ;
# Single List
Idea: send and receive single values for lists of subtrees.
Test different variants of the structure/shape of the send/received value.
## Execution-Model
TODO: check again (old model copied from `singleList`)
```
SenderRoot/ReceiverRoot
|- T_Empty ::= /* empty */ ;
|- T_Token ::= <Value:String> ;
|- T_OneChild ::= Other ;
|- T_OneOpt ::= [Other] ;
|- T_OneList ::= Other* ;
|- T_TwoChildren ::= Left:Other Right:Other ;
|- T_OneOfEach ::= First:Other [Second:Other] Third:Other* <Fourth:String> ;
|- abstract T_Abstract ::= <ValueAbstract> ;
```
## Computation
```
T.ID = Input
T.token = Input
T.Other.ID = Input + 1
```
## Execution-Trace (SendInitialValue)
Inputs:
- 1
- 1
- 2
- 3
| Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A |
|---|---|---|---|---|---|---|
| * | [1,2,3,4,0] | 5 | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] | [1,2,3,4,0] |
| I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] |
| I1:1 | [2,2,3,4,0] | 6 | [2,2,3,4,0] | [2,2,3,4,0] | [1,2,3,4,0,2] | [1,2,3,4,0,2] |
| I1:2 | [3,2,3,4,0] | 7 | [3,2,3,4,0] | [3,2,3,4,0] | [1,2,3,4,0,2,3] | [1,2,3,4,0,2,3] |
| IO:5 | [3,2,3,4,5] | 8 | [3,2,3,4,5] | [3,2,3,4,5] | [1,2,3,4,0,2,3,5] | [1,2,3,4,0,2,3,5]
| I3:4 | [3,2,7,4,5] | 9 | [3,2,7,4,5] | [3,2,7,4,5] | [1,2,3,4,0,2,3,5,7] | [1,2,3,4,0,2,3,5,7] |
*: (1:0, 2:0, 3:0, 4:0, 5:0)
## Execution-Trace (OnlyUpdate)
| Input | [A1,A2,A3,A4,IO] | # | A* | UsingWcA | WithAddA | UsingWcWithAddA:A |
|---|---|---|---|---|---|---|
| * | [-,-,-,-,-] | 0 | [0,0,0,0,0] | [] | [] | [] |
| I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] |
| I1:1 | [2,-,-,-,-] | 1 | [2,0,0,0,0] | [2] | [2] | [2] |
| I1:2 | [3,-,-,-,-] | 2 | [3,0,0,0,0] | [3] | [2,3] | [2,3] |
| IO:5 | [2,-,-,-,5] | 3 | [3,0,0,0,5] | [3,5] | [2,3,5] | [2,3,5]
| I3:4 | [2,-,7,-,5] | 4 | [3,0,7,0,5] | [3,5,7] | [2,3,5,7] | [2,3,5,7] |
*: (1:0, 2:0, 3:0, 4:0, 5:0)
send tree SenderRoot.T_Empty ;
send tree SenderRoot.T_Token ;
send tree SenderRoot.T_OneChild ;
send tree SenderRoot.T_OneOpt ;
send tree SenderRoot.T_OneList ;
send tree SenderRoot.T_TwoChildren ;
send tree SenderRoot.T_OneOfEach ;
send tree SenderRoot.T_Abstract ;
receive tree ReceiverRoot.T_Empty ;
receive tree ReceiverRoot.T_Token ;
receive tree ReceiverRoot.T_OneChild ;
receive tree ReceiverRoot.T_OneOpt ;
receive tree ReceiverRoot.T_OneList ;
receive tree ReceiverRoot.T_TwoChildren ;
receive tree ReceiverRoot.T_OneOfEach ;
receive tree ReceiverRoot.T_Abstract ;
receive tree ReceiverRoot.MyEmpty ;
receive tree with add ReceiverRoot.EmptyWithAdd ;
receive tree with add ReceiverRoot.TokenWithAdd ;
receive tree with add ReceiverRoot.OneChildWithAdd ;
receive tree with add ReceiverRoot.OneOptWithAdd ;
receive tree with add ReceiverRoot.OneListWithAdd ;
receive tree with add ReceiverRoot.TwoChildrenWithAdd ;
receive tree with add ReceiverRoot.OneOfEachWithAdd ;
receive tree with add ReceiverRoot.AbstractWithAdd ;
aspect Computation {
syn T_Empty SenderRoot.getT_Empty() = new T_Empty().setID(getInput());
syn T_Token SenderRoot.getT_Token() = new T_Token().setID(getInput())
.setValue(Integer.toString(getInput()));
syn T_OneChild SenderRoot.getT_OneChild() {
T_OneChild result = new T_OneChild().setID(getInput());
result.setOther(createOther());
return result;
}
syn T_OneOpt SenderRoot.getT_OneOpt() {
T_OneOpt result = new T_OneOpt().setID(getInput());
if (getShouldSetOptAndList()) {
result.setOther(createOther());
}
return result;
}
syn T_OneList SenderRoot.getT_OneList() {
T_OneList result = new T_OneList().setID(getInput());
if (getShouldSetOptAndList()) {
result.addOther(createOther());
}
return result;
}
syn T_TwoChildren SenderRoot.getT_TwoChildren() {
T_TwoChildren result = new T_TwoChildren().setID(getInput());
result.setLeft(createOther());
result.setRight(createOther());
return result;
}
syn T_OneOfEach SenderRoot.getT_OneOfEach() {
T_OneOfEach result = new T_OneOfEach().setID(getInput());
result.setFirst(createOther());
if (getShouldSetOptAndList()) {
result.setSecond(createOther());
result.addThird(createOther());
}
result.setFourth(Integer.toString(getInput()));
return result;
}
syn T_Abstract SenderRoot.getT_Abstract() = new T_SubClass()
.setValueSub(Integer.toString(getInput()))
.setID(getInput())
.setValueAbstract(Integer.toString(getInput()));
private Other SenderRoot.createOther() {
return new Other().setID(getInput() + 1);
}
syn boolean ASTNode.isNameable() = false;
eq Nameable.isNameable() = true;
}
aspect Testing {
class SenderRoot implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperSenderRoot {}
class ReceiverRoot implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperReceiverRoot {}
class Other implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperOther {}
class T_Empty implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_Empty {}
class T_Token implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_Token {}
class T_OneChild implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_OneChild {}
class T_OneOpt implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_OneOpt {}
class T_OneList implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_OneList {}
class T_TwoChildren implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_TwoChildren {}
class T_OneOfEach implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_OneOfEach {}
class T_Abstract implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperT_Abstract {}
class JastAddList<T> implements org.jastadd.ragconnect.tests.singleListVariant.AbstractSingleListVariantTest.TestWrapperJastAddList<T> {}
}
aspect NameResolution {
// overriding customID guarantees to produce the same JSON representation for equal lists
// otherwise, the value for id is different each time
@Override
protected String Nameable.customID() {
return getClass().getSimpleName() + getID();
}
}
Root ::= SenderRoot* ReceiverRoot* ;
Nameable ::= <ID:int> ;
SenderRoot : Nameable ::= <Input:int> <ShouldSetOptAndList:boolean>
/T_Empty/
/T_Token/
/T_OneChild/
/T_OneOpt/
/T_OneList/
/T_TwoChildren/
/T_OneOfEach/
/T_Abstract/
;
ReceiverRoot : Nameable ::=
T_Empty*
T_Token*
T_OneChild*
T_OneOpt*
T_OneList*
T_TwoChildren*
T_OneOfEach*
T_Abstract*
MyEmpty:T_Empty*
EmptyWithAdd:T_Empty*
TokenWithAdd:T_Token*
OneChildWithAdd:T_OneChild*
OneOptWithAdd:T_OneOpt*
OneListWithAdd:T_OneList*
TwoChildrenWithAdd:T_TwoChildren*
OneOfEachWithAdd:T_OneOfEach*
AbstractWithAdd:T_Abstract*
;
T_Empty : Nameable ::= /* empty */ ;
T_Token : Nameable ::= <Value:String> ;
T_OneChild : Nameable ::= Other ;
T_OneOpt : Nameable ::= [Other] ;
T_OneList : Nameable ::= Other* ;
T_TwoChildren : Nameable ::= Left:Other Right:Other ;
T_OneOfEach : Nameable ::= First:Other [Second:Other] Third:Other* <Fourth:String> ;
abstract T_Abstract : Nameable ::= <ValueAbstract>;
T_SubClass : T_Abstract ::= <ValueSub> ;
Other : Nameable ;
SenderRoot.T_Empty canDependOn SenderRoot.Input as InputDependencyToT_Empty ;
SenderRoot.T_Token canDependOn SenderRoot.Input as InputDependencyToT_Token ;
SenderRoot.T_OneChild canDependOn SenderRoot.Input as InputDependencyToT_OneChild ;
SenderRoot.T_OneOpt canDependOn SenderRoot.ShouldSetOptAndList as ShouldSetOptAndListDependencyToT_OneOpt ;
SenderRoot.T_OneOpt canDependOn SenderRoot.Input as InputDependencyToT_OneOpt ;
SenderRoot.T_OneList canDependOn SenderRoot.ShouldSetOptAndList as ShouldSetOptAndListDependencyToT_OneList ;
SenderRoot.T_OneList canDependOn SenderRoot.Input as InputDependencyToT_OneList ;
SenderRoot.T_TwoChildren canDependOn SenderRoot.Input as InputDependencyToT_TwoChildren ;
SenderRoot.T_OneOfEach canDependOn SenderRoot.ShouldSetOptAndList as ShouldSetOptAndListDependencyToT_OneOfEach ;
SenderRoot.T_OneOfEach canDependOn SenderRoot.Input as InputDependencyToT_OneOfEach ;
SenderRoot.T_Abstract canDependOn SenderRoot.Input as InputDependencyToT_Abstract ;
# Tree
Idea: send and receive subtrees, test different relations within the subtree which was sent.
Once without incremental evaluation (i.e., using manual dependencies), and the other time with incremental evaluation
send tree SenderRoot.Alfa ;
receive tree ReceiverRoot.Alfa ;
aspect Computation {
syn Alfa SenderRoot.getAlfa() {
Alfa result = new Alfa();
for (int i = 0; i < 4; i++) {
result.addBravo(new Bravo().setID(i));
result.addCharlie(new Charlie().setID(i));
result.addDelta(new Delta().setID(i));
}
Bravo inputBravo = result.getBravo(getInput());
Charlie inputCharlie = result.getCharlie(getInput());
Delta inputDelta = result.getDelta(getInput());
// rel Alfa.MyBravo -> Bravo ;
result.setMyBravo(inputBravo);
// rel Alfa.OptionalBravo? -> Bravo ;
result.setOptionalBravo(inputBravo);
// rel Alfa.MultiBravo* -> Bravo ;
result.addMultiBravo(inputBravo);
result.addMultiBravo(result.getBravo(getInput() + 1));
// rel Charlie.MyAlfa? -> Alfa ;
inputCharlie.setMyAlfa(result);
// rel Alfa.SingleBi1Delta <-> Delta.SingleBack1Alfa? ;
result.setSingleBi1Delta(inputDelta);
// rel Alfa.MultiBi2Delta* <-> Delta.SingleBack2Alfa? ;
result.addMultiBi2Delta(inputDelta);
result.addMultiBi2Delta(result.getDelta(getInput() + 1));
// rel Alfa.MultiBi3Delta* <-> Delta.MultiBack3Alfa* ;
result.addMultiBi3Delta(inputDelta);
result.addMultiBi3Delta(result.getDelta(getInput() + 1));
// rel Alfa.Myself -> Alfa ;
result.setMyself(result);
// rel Bravo.MyCharlie -> Charlie ;
for (int i = 0; i < 4; i++) {
if (i == getInput()) {
result.getBravo(i).setMyCharlie(inputCharlie);
} else {
result.getBravo(i).setMyCharlie(result.getCharlie(0));
}
}
// rel Bravo.OptionalCharlie? -> Charlie ;
inputBravo.setOptionalCharlie(inputCharlie);
// rel Bravo.MultiCharlie* -> Charlie ;
inputBravo.addMultiCharlie(inputCharlie);
inputBravo.addMultiCharlie(result.getCharlie(getInput() + 1));
// rel Bravo.SingleBi1Delta? <-> Delta.SingleBack1Bravo? ;
inputBravo.setSingleBi1Delta(inputDelta);
// rel Bravo.MultiBi2Delta* <-> Delta.SingleBack2Bravo? ;
inputBravo.addMultiBi2Delta(inputDelta);
inputBravo.addMultiBi2Delta(result.getDelta(getInput() + 1));
// rel Bravo.MultiBi3Delta* <-> Delta.MultiBack3Bravo* ;
inputBravo.addMultiBi3Delta(inputDelta);
inputBravo.addMultiBi3Delta(result.getDelta(getInput() + 1));
result.getBravo(getInput() + 1).addMultiBi3Delta(inputDelta);
result.getBravo(getInput() + 1).addMultiBi3Delta(result.getDelta(getInput() + 1));
return result;
}
syn boolean ASTNode.isNameable() = false;
eq Nameable.isNameable() = true;
}
aspect Testing {
class ReceiverRoot implements org.jastadd.ragconnect.tests.tree.AbstractTreeTest.TestWrapperReceiverRoot {}
class Alfa implements org.jastadd.ragconnect.tests.tree.AbstractTreeTest.TestWrapperAlfa {}
class Bravo implements org.jastadd.ragconnect.tests.tree.AbstractTreeTest.TestWrapperBravo {}
class Charlie implements org.jastadd.ragconnect.tests.tree.AbstractTreeTest.TestWrapperCharlie {}
class Delta implements org.jastadd.ragconnect.tests.tree.AbstractTreeTest.TestWrapperDelta {}
}
aspect NameResolution {
@Override
protected String Nameable.customID() {
return getClass().getSimpleName() + getID();
}
}
Root ::= SenderRoot* ReceiverRoot* ;
Nameable ::= <ID:int> ;
SenderRoot : Nameable ::= <Input:int> /Alfa/ ;
ReceiverRoot : Nameable ::= Alfa ;
Alfa : Nameable ::= <Value:String> Bravo* Charlie* Delta* ;
Bravo : Nameable ;
Charlie : Nameable ;
Delta : Nameable ;
rel Alfa.Myself -> Alfa ;
// Alfa -> Bravo
rel Alfa.MyBravo -> Bravo ;
rel Alfa.OptionalBravo? -> Bravo ;
rel Alfa.MultiBravo* -> Bravo ;
// Charlie -> Alfa
rel Charlie.MyAlfa? -> Alfa ;
// Alfa <-> Delta
rel Alfa.SingleBi1Delta <-> Delta.SingleBack1Alfa? ;
rel Alfa.MultiBi2Delta* <-> Delta.SingleBack2Alfa? ;
rel Alfa.MultiBi3Delta* <-> Delta.MultiBack3Alfa* ;
// Bravo -> Charlie
rel Bravo.MyCharlie -> Charlie ;
rel Bravo.OptionalCharlie? -> Charlie ;
rel Bravo.MultiCharlie* -> Charlie ;
// Bravo <-> Delta
rel Bravo.SingleBi1Delta? <-> Delta.SingleBack1Bravo? ;
rel Bravo.MultiBi2Delta* <-> Delta.SingleBack2Bravo? ;
rel Bravo.MultiBi3Delta* <-> Delta.MultiBack3Bravo* ;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment