Commit 3a6b58c7 authored by Alexander David Hellwig's avatar Alexander David Hellwig
Browse files

Update to new EMA Version

parent be909e68
Pipeline #95612 failed with stages
in 73 minutes and 35 seconds
......@@ -30,7 +30,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-deeplearning</artifactId>
<version>0.2.3</version>
<version>0.2.4</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......@@ -41,13 +41,13 @@
<se-commons.version>1.7.8</se-commons.version>
<mc.grammars.assembly.version>0.0.6</mc.grammars.assembly.version>
<Common-MontiCar.version>0.0.14-20180704.113055-2</Common-MontiCar.version>
<Embedded-MontiArc.version>0.0.18-20180615.111713-1</Embedded-MontiArc.version>
<Embedded-MontiArc-Math.version>0.0.19-20180718.152548-1</Embedded-MontiArc-Math.version>
<Embedded-MontiArc-MathOpt.version>0.1.1</Embedded-MontiArc-MathOpt.version>
<Embedded-MontiArc-Behaviour.version>0.0.14-20180704.112922-2</Embedded-MontiArc-Behaviour.version>
<Embedded-MontiArc.version>0.1.7-SNAPSHOT</Embedded-MontiArc.version>
<Embedded-MontiArc-Math.version>0.1.4-SNAPSHOT</Embedded-MontiArc-Math.version>
<Embedded-MontiArc-MathOpt.version>0.1.3-SNAPSHOT</Embedded-MontiArc-MathOpt.version>
<Embedded-MontiArc-Behaviour.version>0.0.15-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<CNNArch.version>0.2.7</CNNArch.version>
<Math.version>0.0.19-20180727.084044-1</Math.version>
<MathOpt.version>0.1.0</MathOpt.version>
<Math.version>0.0.19-SNAPSHOT</Math.version>
<MathOpt.version>0.1.1-SNAPSHOT</MathOpt.version>
<!-- .. Libraries .................................................. -->
<guava.version>18.0</guava.version>
......@@ -88,6 +88,12 @@
<version>${se-commons.version}</version>
</dependency>
<dependency>
<groupId>de.se_rwth.commons</groupId>
<artifactId>se-commons-utilities</artifactId>
<version>${se-commons.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
......
......@@ -20,13 +20,13 @@
*/
package de.monticore.lang.monticar.emadl._cocos;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.cnnarch._cocos.CNNArchCocos;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
public class CheckArchitecture{
public static void check(ExpandedComponentInstanceSymbol instance) {
public static void check(EMAComponentInstanceSymbol instance) {
ArchitectureSymbol architecture = instance.getSpannedScope().
<ArchitectureSymbol>resolve("", ArchitectureSymbol.KIND).get();
CNNArchCocos.checkAll(architecture);
......
......@@ -21,7 +21,7 @@
package de.monticore.lang.monticar.emadl._cocos;
import de.monticore.lang.embeddedmontiarc.cocos.*;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarcmath.cocos.AtomicComponentCoCo;
import de.monticore.lang.math._cocos.MatrixAssignmentDeclarationCheck;
import de.monticore.lang.monticar.cnnarch._cocos.CNNArchCocos;
......@@ -32,7 +32,7 @@ import java.util.Optional;
//check all cocos
public class EMADLCocos {
public static void checkAll(ExpandedComponentInstanceSymbol instance){
public static void checkAll(EMAComponentInstanceSymbol instance){
Optional<ArchitectureSymbol> architecture = instance.getSpannedScope().
resolve("", ArchitectureSymbol.KIND);
......
......@@ -20,7 +20,11 @@
*/
package de.monticore.lang.monticar.emadl._symboltable;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.*;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAComponentSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortArraySymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceBuilder;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAPortInstanceSymbol;
import de.monticore.lang.math._ast.ASTNumberExpression;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
......@@ -33,12 +37,12 @@ import de.se_rwth.commons.logging.Log;
import java.util.*;
public class ModifiedExpandedComponentInstanceBuilder extends ExpandedComponentInstanceBuilder {
public class ModifiedExpandedComponentInstanceBuilder extends EMAComponentInstanceBuilder {
@Override
public ExpandedComponentInstanceSymbol build() {
ExpandedComponentInstanceSymbol instance = super.build();
ComponentSymbol component = instance.getComponentType().getReferencedSymbol();
public EMAComponentInstanceSymbol build() {
EMAComponentInstanceSymbol instance = super.build();
EMAComponentSymbol component = instance.getComponentType().getReferencedSymbol();
Optional<ArchitectureSymbol> architecture = component.getSpannedScope()
.resolve("", ArchitectureSymbol.KIND);
......@@ -54,7 +58,7 @@ public class ModifiedExpandedComponentInstanceBuilder extends ExpandedComponentI
return instance;
}
public void addVariableSymbolsToInstance(ExpandedComponentInstanceSymbol instance){
public void addVariableSymbolsToInstance(EMAComponentInstanceSymbol instance){
//add generics
for (ResolutionDeclarationSymbol sym : instance.getResolutionDeclarationSymbols()){
if (sym.getASTResolution() instanceof ASTUnitNumberResolution){
......@@ -96,18 +100,18 @@ public class ModifiedExpandedComponentInstanceBuilder extends ExpandedComponentI
}
}
public void addPortArraySymbolsToInstance(ExpandedComponentInstanceSymbol instance){
Map<String, List<PortSymbol>> nameToPortList = new HashMap<>();
for (PortSymbol port : instance.getPortsList()){
List<PortSymbol> list = nameToPortList
public void addPortArraySymbolsToInstance(EMAComponentInstanceSymbol instance){
Map<String, List<EMAPortInstanceSymbol>> nameToPortList = new HashMap<>();
for (EMAPortInstanceSymbol port : instance.getPortInstanceList()){
List<EMAPortInstanceSymbol> list = nameToPortList
.computeIfAbsent(port.getNameWithoutArrayBracketPart(), k -> new ArrayList<>());
list.add(port);
}
for (String name : nameToPortList.keySet()){
if (!instance.getSpannedScope().resolveLocally(name, PortArraySymbol.KIND).isPresent()) {
List<PortSymbol> ports = nameToPortList.get(name);
PortArraySymbol portArray = new PortArraySymbol(name, null);
if (!instance.getSpannedScope().resolveLocally(name, EMAPortArraySymbol.KIND).isPresent()) {
List<EMAPortInstanceSymbol> ports = nameToPortList.get(name);
EMAPortArraySymbol portArray = new EMAPortArraySymbol(name, null);
portArray.setDimension(ports.size());
portArray.setDirection(ports.get(0).isIncoming());
portArray.setTypeReference(ports.get(0).getTypeReference());
......
......@@ -22,7 +22,7 @@ package de.monticore.lang.monticar.emadl.adapter;
import de.monticore.ast.ASTNode;
import de.monticore.expressionsbasis._ast.ASTExpression;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortArraySymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortArraySymbol;
import de.monticore.lang.math._ast.ASTNameExpression;
import de.monticore.lang.math._ast.ASTNumberExpression;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchSimpleExpressionSymbol;
......@@ -42,11 +42,11 @@ import java.util.List;
import java.util.Optional;
public class PortArraySymbol2IODeclarationSymbol extends IODeclarationSymbol
implements SymbolAdapter<PortArraySymbol> {
implements SymbolAdapter<EMAPortArraySymbol> {
private final PortArraySymbol adaptee;
private final EMAPortArraySymbol adaptee;
public PortArraySymbol2IODeclarationSymbol(PortArraySymbol ps) {
public PortArraySymbol2IODeclarationSymbol(EMAPortArraySymbol ps) {
super(ps.getName());
setInput(ps.isIncoming());
setArrayLength(ps.getDimension());
......@@ -71,12 +71,12 @@ public class PortArraySymbol2IODeclarationSymbol extends IODeclarationSymbol
}
@Override
public PortArraySymbol getAdaptee() {
public EMAPortArraySymbol getAdaptee() {
return adaptee;
}
private ASTType getASTType(PortArraySymbol port){
private ASTType getASTType(EMAPortArraySymbol port){
MCTypeSymbol type = port.getTypeReference().getReferencedSymbol();
if (type instanceof MCASTTypeSymbol){
return ((MCASTTypeSymbol) type).getAstType();
......@@ -86,7 +86,7 @@ public class PortArraySymbol2IODeclarationSymbol extends IODeclarationSymbol
}
}
private List<ArchSimpleExpressionSymbol> getShape(PortArraySymbol port){
private List<ArchSimpleExpressionSymbol> getShape(EMAPortArraySymbol port){
List<ArchSimpleExpressionSymbol> dimensionList = new ArrayList<>(4);
ASTType astType = getASTType(port);
......@@ -109,7 +109,7 @@ public class PortArraySymbol2IODeclarationSymbol extends IODeclarationSymbol
return dimensionList;
}
private ASTElementType getElementType(PortArraySymbol port){
private ASTElementType getElementType(EMAPortArraySymbol port){
ASTType astType = getASTType(port);
if (astType instanceof ASTCommonMatrixType){
return ((ASTCommonMatrixType) astType).getElementType();
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.emadl.adapter;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.PortArraySymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortArraySymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IODeclarationSymbol;
import de.monticore.symboltable.Symbol;
import de.monticore.symboltable.resolving.TransitiveAdaptedResolvingFilter;
......@@ -28,14 +28,14 @@ import de.monticore.symboltable.resolving.TransitiveAdaptedResolvingFilter;
public class PortArraySymbol2IODeclarationSymbolTypeFilter extends TransitiveAdaptedResolvingFilter<IODeclarationSymbol> {
public PortArraySymbol2IODeclarationSymbolTypeFilter() {
super(PortArraySymbol.KIND,
super(EMAPortArraySymbol.KIND,
IODeclarationSymbol.class,
IODeclarationSymbol.KIND);
}
@Override
public Symbol translate(Symbol adaptee) {
assert adaptee instanceof PortArraySymbol;
return new PortArraySymbol2IODeclarationSymbol((PortArraySymbol) adaptee);
assert adaptee instanceof EMAPortArraySymbol;
return new PortArraySymbol2IODeclarationSymbol((EMAPortArraySymbol) adaptee);
}
}
\ No newline at end of file
......@@ -23,7 +23,7 @@ package de.monticore.lang.monticar.emadl;
import de.monticore.ModelingLanguageFamily;
import de.monticore.io.paths.ModelPath;
import de.monticore.lang.embeddedmontiarc.LogConfig;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ConstantPortSymbol;
import de.monticore.lang.embeddedmontiarc.helper.ConstantPortHelper;
import de.monticore.lang.monticar.emadl._symboltable.EMADLLanguage;
import de.monticore.lang.monticar.enumlang._symboltable.EnumLangLanguage;
import de.monticore.lang.monticar.streamunits._symboltable.StreamUnitsLanguage;
......@@ -35,7 +35,7 @@ import java.nio.file.Paths;
public class AbstractSymtabTest {
protected static Scope createSymTab(String... modelPath) {
ConstantPortSymbol.resetLastID();
ConstantPortHelper.resetLastID();
ModelingLanguageFamily fam = new ModelingLanguageFamily();
EMADLLanguage montiArcLanguage = new EMADLLanguage();
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.emadl;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.CompositeElementSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.LayerSymbol;
......@@ -44,12 +44,12 @@ public class InstanceTest extends AbstractSymtabTest {
@Test
public void testInstances(){
Scope symtab = createSymTab("src/test/resources/models/");
ExpandedComponentInstanceSymbol mainInstance = symtab.<ExpandedComponentInstanceSymbol>
resolve("InstanceTest.mainB", ExpandedComponentInstanceSymbol.KIND).get();
ExpandedComponentInstanceSymbol net1 = mainInstance.getSpannedScope().<ExpandedComponentInstanceSymbol>
resolve("net1", ExpandedComponentInstanceSymbol.KIND).get();
ExpandedComponentInstanceSymbol net2 = mainInstance.getSpannedScope().<ExpandedComponentInstanceSymbol>
resolve("net2", ExpandedComponentInstanceSymbol.KIND).get();
EMAComponentInstanceSymbol mainInstance = symtab.<EMAComponentInstanceSymbol>
resolve("InstanceTest.mainB", EMAComponentInstanceSymbol.KIND).get();
EMAComponentInstanceSymbol net1 = mainInstance.getSpannedScope().<EMAComponentInstanceSymbol>
resolve("net1", EMAComponentInstanceSymbol.KIND).get();
EMAComponentInstanceSymbol net2 = mainInstance.getSpannedScope().<EMAComponentInstanceSymbol>
resolve("net2", EMAComponentInstanceSymbol.KIND).get();
ArchitectureSymbol arch1 = net1.getSpannedScope().<ArchitectureSymbol>
resolve("", ArchitectureSymbol.KIND).get();
......
......@@ -21,7 +21,7 @@
package de.monticore.lang.monticar.emadl;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ComponentSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.emadl._parser.EMADLParser;
import de.monticore.symboltable.Scope;
import de.se_rwth.commons.logging.Log;
......@@ -51,7 +51,7 @@ public class SymtabTest extends AbstractSymtabTest {
public void testAlexnet(){
Scope symTab = createSymTab("src/test/resources/models");
ComponentSymbol a = symTab.<ComponentSymbol>resolve("ResNet34", ComponentSymbol.KIND).orElse(null);
ExpandedComponentInstanceSymbol c = symTab.<ExpandedComponentInstanceSymbol>resolve("resNet34", ExpandedComponentInstanceSymbol.KIND).orElse(null);
EMAComponentInstanceSymbol c = symTab.<EMAComponentInstanceSymbol>resolve("resNet34", EMAComponentInstanceSymbol.KIND).orElse(null);
assertNotNull(a);
}
......
......@@ -21,7 +21,7 @@
package de.monticore.lang.monticar.emadl.cocos;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ComponentSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.monticar.emadl.AbstractSymtabTest;
import de.monticore.lang.monticar.emadl._cocos.EMADLCocos;
import de.monticore.symboltable.Scope;
......@@ -44,15 +44,15 @@ public class AbstractCoCoTest extends AbstractSymtabTest {
private static final String MODEL_PATH = "src/test/resources/";
protected static ExpandedComponentInstanceSymbol getComponentInstance(String modelPath, String model) {
protected static EMAComponentInstanceSymbol getComponentInstance(String modelPath, String model) {
Scope symTab = createSymTab(MODEL_PATH + modelPath);
ComponentSymbol comp = symTab.<ComponentSymbol> resolve(
model, ComponentSymbol.KIND).orElse(null);
assertNotNull("Could not resolve model " + model, comp);
return (ExpandedComponentInstanceSymbol) comp.getEnclosingScope()
.resolveLocally(ExpandedComponentInstanceSymbol.KIND)
return (EMAComponentInstanceSymbol) comp.getEnclosingScope()
.resolveLocally(EMAComponentInstanceSymbol.KIND)
.stream().findFirst().get();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment