Commit 86a80fe3 authored by Evgeny Kusmenko's avatar Evgeny Kusmenko
Browse files

Merge branch 'ba_kisov' into 'master'

Ba_kisov

See merge request !27
parents edf2a818 4642921b
Pipeline #465464 passed with stage
in 6 minutes and 1 second
......@@ -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.6-SNAPSHOT</MathOpt.version>
<CNNArch.version>0.4.4-SNAPSHOT</CNNArch.version>
<CNNArch.version>0.4.6-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 String customFilesPath = "";
private String backend = "";
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(String customFilesPath, String backend) {
super("Embedded MontiArc Deep Learning Language",
FILE_ENDING,
HOST_LANGUAGE,
Arrays.asList(CNNARCH_LANGUAGE, MATH_LANGUAGE));
setBackend(backend);
setCustomFilesPath(customFilesPath);
}
private void setBackend(String backend){
this.backend = backend;
}
public String getBackend(){
return this.backend;
}
private void setCustomFilesPath(String customPythonFilesPath){
this.customFilesPath = customPythonFilesPath;
}
public String getCustomFilesPath(){
return this.customFilesPath;
}
@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,getCustomFilesPath(), getBackend()));
}
}
......@@ -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,
String customFilesPath, String backend) {
super(resolvingConfig, enclosingScope);
initSuperSTC(resolvingConfig, customFilesPath, backend);
}
public EMADLSymbolTableCreator(final ResolvingConfiguration resolvingConfig, final Deque<MutableScope> scopeStack) {
super(resolvingConfig, scopeStack);
initSuperSTC(resolvingConfig);
}
public EMADLSymbolTableCreator(final ResolvingConfiguration resolvingConfig, final Deque<MutableScope> scopeStack,
String customFilesPath, String backend) {
super(resolvingConfig, scopeStack);
initSuperSTC(resolvingConfig, customFilesPath, backend);
}
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, String customFilesPath, String backend) {
this.cnnArchSTC = new CNNArchSymbolTableCreator(resolvingConfig, scopeStack, customFilesPath, backend);
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.
......
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