Aufgrund einer Wartung wird GitLab am 26.10. zwischen 8:00 und 9:00 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to maintenance, GitLab will be temporarily unavailable on 26.10. between 8:00 and 9:00 am.

Commit 2c4c4367 authored by danielkisov's avatar danielkisov
Browse files

Passing the hashmap with custom layers and the path to the directory with them...

Passing the hashmap with custom layers and the path to the directory with them through EMADLLanguage and EMADLSymbolTableCreator
parent 763044ea
Pipeline #425725 failed with stage
in 45 seconds
......@@ -18,7 +18,7 @@
<groupId>de.monticore.lang.monticar</groupId>
<artifactId>embedded-montiarc-deeplearning</artifactId>
<version>0.4.4-SNAPSHOT</version>
<version>0.5.0-SNAPSHOT</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
......@@ -32,7 +32,7 @@
<Embedded-MontiArc-Behaviour.version>0.4.4-SNAPSHOT</Embedded-MontiArc-Behaviour.version>
<Math.version>0.4.4-SNAPSHOT</Math.version>
<MathOpt.version>0.4.4-SNAPSHOT</MathOpt.version>
<CNNArch.version>0.4.4-SNAPSHOT</CNNArch.version>
<CNNArch.version>0.5.0-SNAPSHOT</CNNArch.version>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>5.0.1</monticore.version>
......
......@@ -26,12 +26,13 @@ import java.util.*;
public class EMADLLanguage extends EmbeddingModelingLanguage {
public static final String FILE_ENDING = "emadl";
private HashMap<String, ArrayList<String>> customLayers = null;
private String customPythonFilesPath = "";
public static final EmbeddedMontiArcDynamicLanguage HOST_LANGUAGE = new EmbeddedMontiArcDynamicLanguage();
public static final CNNArchLanguage CNNARCH_LANGUAGE = new CNNArchLanguage();
public static final MathOptLanguage MATH_LANGUAGE = new MathOptLanguage();
public EMADLLanguage() {
super("Embedded MontiArc Deep Learning Language",
FILE_ENDING,
......@@ -39,6 +40,31 @@ public class EMADLLanguage extends EmbeddingModelingLanguage {
Arrays.asList(CNNARCH_LANGUAGE, MATH_LANGUAGE));
}
public EMADLLanguage(HashMap<String, ArrayList<String>> customLayers, String customPythonFilesPath) {
super("Embedded MontiArc Deep Learning Language",
FILE_ENDING,
HOST_LANGUAGE,
Arrays.asList(CNNARCH_LANGUAGE, MATH_LANGUAGE));
setCustomLayers(customLayers);
setCustomPythonFilesPath(customPythonFilesPath);
}
private void setCustomLayers(HashMap<String, ArrayList<String>> customLayers){
this.customLayers = customLayers;
}
public HashMap<String, ArrayList<String>> getCustomLayers(){
return this.customLayers;
}
private void setCustomPythonFilesPath(String customPythonFilesPath){
this.customPythonFilesPath = customPythonFilesPath;
}
public String getCustomPythonFilesPath(){
return this.customPythonFilesPath;
}
@Override
public Collection<ResolvingFilter<? extends Symbol>> getResolvingFilters() {
......@@ -66,7 +92,7 @@ public class EMADLLanguage extends EmbeddingModelingLanguage {
@Override
public Optional<EMADLSymbolTableCreator> getSymbolTableCreator(ResolvingConfiguration resolvingConfiguration, MutableScope enclosingScope) {
return Optional.of(new EMADLSymbolTableCreator(
resolvingConfiguration, enclosingScope));
resolvingConfiguration, enclosingScope, getCustomLayers(), getCustomPythonFilesPath()));
}
}
......@@ -24,7 +24,9 @@ import de.monticore.symboltable.ResolvingConfiguration;
import de.monticore.symboltable.Scope;
import de.se_rwth.commons.logging.Log;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
public class EMADLSymbolTableCreator extends de.monticore.symboltable.CommonSymbolTableCreator
implements EMADLVisitor {
......@@ -43,11 +45,24 @@ public class EMADLSymbolTableCreator extends de.monticore.symboltable.CommonSymb
initSuperSTC(resolvingConfig);
}
public EMADLSymbolTableCreator(
final ResolvingConfiguration resolvingConfig, final MutableScope enclosingScope,
HashMap<String, ArrayList<String>> customLayers, String customPythonFilesPath) {
super(resolvingConfig, enclosingScope);
initSuperSTC(resolvingConfig, customLayers, customPythonFilesPath);
}
public EMADLSymbolTableCreator(final ResolvingConfiguration resolvingConfig, final Deque<MutableScope> scopeStack) {
super(resolvingConfig, scopeStack);
initSuperSTC(resolvingConfig);
}
public EMADLSymbolTableCreator(final ResolvingConfiguration resolvingConfig, final Deque<MutableScope> scopeStack,
HashMap<String, ArrayList<String>> customLayers, String customPythonFilesPath) {
super(resolvingConfig, scopeStack);
initSuperSTC(resolvingConfig, customLayers, customPythonFilesPath);
}
private void initSuperSTC(final ResolvingConfiguration resolvingConfig) {
this.cnnArchSTC = new CNNArchSymbolTableCreator(resolvingConfig, scopeStack);
this.emamSTC = new EmbeddedMontiArcMathSymbolTableCreatorTOP(resolvingConfig, scopeStack);
......@@ -75,6 +90,33 @@ public class EMADLSymbolTableCreator extends de.monticore.symboltable.CommonSymb
visitor.setCommon2Visitor(emamSTC);
}
private void initSuperSTC(final ResolvingConfiguration resolvingConfig, HashMap<String, ArrayList<String>> customLayers, String customPythonFilesPath) {
this.cnnArchSTC = new CNNArchSymbolTableCreator(resolvingConfig, scopeStack, customLayers, customPythonFilesPath);
this.emamSTC = new EmbeddedMontiArcMathSymbolTableCreatorTOP(resolvingConfig, scopeStack);
this.mathOptSTC = new MathOptSymbolTableCreator(resolvingConfig, scopeStack);
this.emadSTC = new ModifiedEMADynamicSymbolTableCreator(resolvingConfig, scopeStack);
this.emadSTC.setInstanceSymbolCreator(new ModifiedEMAComponentInstanceSymbolCreator()); //Use an instance symbo, creator that adds math statement to instances
this.emaBehaviorSTC = new EmbeddedMontiArcBehaviorSymbolTableCreator(resolvingConfig, scopeStack);
visitor.setEMADLVisitor(this);
visitor.setCNNArchVisitor(cnnArchSTC);
visitor.setEmbeddedMontiArcMathVisitor(emamSTC);
visitor.setEmbeddedMontiArcVisitor(emadSTC);
visitor.setEmbeddedMontiArcDynamicVisitor(emadSTC);
visitor.setEmbeddedMontiArcBehaviorVisitor(emaBehaviorSTC);
visitor.setMathVisitor(mathOptSTC);
visitor.setExpressionsBasisVisitor(mathOptSTC);
visitor.setCommonExpressionsVisitor(mathOptSTC);
visitor.setAssignmentExpressionsVisitor(mathOptSTC);
visitor.setMatrixExpressionsVisitor(mathOptSTC);
visitor.setMatrixVisitor(mathOptSTC);
visitor.setTypes2Visitor(mathOptSTC);
visitor.setMathOptVisitor(mathOptSTC);
visitor.setCommon2Visitor(emamSTC);
}
/**
* Creates the symbol table starting from the <code>rootNode</code> and
* returns the first scope that was created.
......
/**
* (c) https://github.com/MontiCore/monticore
*
* The license generally applicable for this project
* can be found under https://github.com/MontiCore/monticore.
*/
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.emadl._symboltable;
......
Markdown is supported
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