Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
E
EMADL2CPP
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
monticore
EmbeddedMontiArc
generators
EMADL2CPP
Commits
67385f3d
Commit
67385f3d
authored
May 30, 2018
by
Thomas Michael Timmermanns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved generator from EmbeddedMontiArcDL to this repo.
parent
a9fc8933
Changes
49
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
49 changed files
with
3215 additions
and
0 deletions
+3215
-0
.gitignore
.gitignore
+9
-0
.travis.yml
.travis.yml
+5
-0
pom.xml
pom.xml
+410
-0
src/license/se/license.txt
src/license/se/license.txt
+18
-0
src/main/java/de/monticore/lang/monticar/emadl/generator/AbstractSymtab.java
...nticore/lang/monticar/emadl/generator/AbstractSymtab.java
+81
-0
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGenerator.java
...nticore/lang/monticar/emadl/generator/EMADLGenerator.java
+337
-0
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGeneratorCli.java
...core/lang/monticar/emadl/generator/EMADLGeneratorCli.java
+104
-0
src/main/java/de/monticore/lang/monticar/emadl/generator/TemplateConfiguration.java
.../lang/monticar/emadl/generator/TemplateConfiguration.java
+48
-0
src/main/resources/templates/CNNTrainer.ftl
src/main/resources/templates/CNNTrainer.ftl
+21
-0
src/main/resources/templates/CNNTranslator.ftl
src/main/resources/templates/CNNTranslator.ftl
+127
-0
src/test/java/de/monticore/lang/monticar/emadl/AbstractSymtabTest.java
.../de/monticore/lang/monticar/emadl/AbstractSymtabTest.java
+101
-0
src/test/java/de/monticore/lang/monticar/emadl/GenerationTest.java
...java/de/monticore/lang/monticar/emadl/GenerationTest.java
+128
-0
src/test/java/de/monticore/lang/monticar/emadl/SymtabTest.java
...est/java/de/monticore/lang/monticar/emadl/SymtabTest.java
+60
-0
src/test/resources/models/Add.emadl
src/test/resources/models/Add.emadl
+10
-0
src/test/resources/models/Alexnet.cnnt
src/test/resources/models/Alexnet.cnnt
+7
-0
src/test/resources/models/Alexnet.emadl
src/test/resources/models/Alexnet.emadl
+47
-0
src/test/resources/models/InstanceTest/CalculateClassB.emadl
src/test/resources/models/InstanceTest/CalculateClassB.emadl
+22
-0
src/test/resources/models/InstanceTest/MainB.emadl
src/test/resources/models/InstanceTest/MainB.emadl
+25
-0
src/test/resources/models/InstanceTest/NetworkB.emadl
src/test/resources/models/InstanceTest/NetworkB.emadl
+24
-0
src/test/resources/models/InstanceTest/NetworkB_net1.cnnt
src/test/resources/models/InstanceTest/NetworkB_net1.cnnt
+9
-0
src/test/resources/models/InstanceTest/NetworkB_net2.cnnt
src/test/resources/models/InstanceTest/NetworkB_net2.cnnt
+9
-0
src/test/resources/models/InvalidLayerInput.emadl
src/test/resources/models/InvalidLayerInput.emadl
+32
-0
src/test/resources/models/MultipleOutputs.cnnt
src/test/resources/models/MultipleOutputs.cnnt
+11
-0
src/test/resources/models/MultipleOutputs.emadl
src/test/resources/models/MultipleOutputs.emadl
+29
-0
src/test/resources/models/ResNeXt50.cnnt
src/test/resources/models/ResNeXt50.cnnt
+11
-0
src/test/resources/models/ResNeXt50.emadl
src/test/resources/models/ResNeXt50.emadl
+45
-0
src/test/resources/models/ResNet152.cnnt
src/test/resources/models/ResNet152.cnnt
+11
-0
src/test/resources/models/ResNet152.emadl
src/test/resources/models/ResNet152.emadl
+39
-0
src/test/resources/models/ResNet34.cnnt
src/test/resources/models/ResNet34.cnnt
+11
-0
src/test/resources/models/ResNet34.emadl
src/test/resources/models/ResNet34.emadl
+37
-0
src/test/resources/models/ThreeInputCNN_M14.cnnt
src/test/resources/models/ThreeInputCNN_M14.cnnt
+11
-0
src/test/resources/models/ThreeInputCNN_M14.emadl
src/test/resources/models/ThreeInputCNN_M14.emadl
+30
-0
src/test/resources/models/VGG16.cnnt
src/test/resources/models/VGG16.cnnt
+11
-0
src/test/resources/models/VGG16.emadl
src/test/resources/models/VGG16.emadl
+34
-0
src/test/resources/models/cifar10/ArgMax.emadl
src/test/resources/models/cifar10/ArgMax.emadl
+19
-0
src/test/resources/models/cifar10/Cifar10Classifier.emadl
src/test/resources/models/cifar10/Cifar10Classifier.emadl
+18
-0
src/test/resources/models/cifar10/CifarNetwork.cnnt
src/test/resources/models/cifar10/CifarNetwork.cnnt
+11
-0
src/test/resources/models/cifar10/CifarNetwork.emadl
src/test/resources/models/cifar10/CifarNetwork.emadl
+40
-0
src/test/resources/models/simulator/MainController.emadl
src/test/resources/models/simulator/MainController.emadl
+47
-0
src/test/resources/models/simulator/SteerController.emadl
src/test/resources/models/simulator/SteerController.emadl
+25
-0
src/test/resources/models/simulator/SteeringAngleCalculator.emadl
.../resources/models/simulator/SteeringAngleCalculator.emadl
+76
-0
src/test/resources/target_code/CNNBufferFile.h
src/test/resources/target_code/CNNBufferFile.h
+51
-0
src/test/resources/target_code/CNNCreator_cifar10_cifar10Classifier_net.py
...s/target_code/CNNCreator_cifar10_cifar10Classifier_net.py
+658
-0
src/test/resources/target_code/CNNPredictor_cifar10_cifar10Classifier_net.h
.../target_code/CNNPredictor_cifar10_cifar10Classifier_net.h
+109
-0
src/test/resources/target_code/CNNTrainer_cifar10_Cifar10Classifier.py
...urces/target_code/CNNTrainer_cifar10_Cifar10Classifier.py
+26
-0
src/test/resources/target_code/CNNTranslator.h
src/test/resources/target_code/CNNTranslator.h
+127
-0
src/test/resources/target_code/cifar10_cifar10Classifier.h
src/test/resources/target_code/cifar10_cifar10Classifier.h
+32
-0
src/test/resources/target_code/cifar10_cifar10Classifier_calculateClass.h
...es/target_code/cifar10_cifar10Classifier_calculateClass.h
+30
-0
src/test/resources/target_code/cifar10_cifar10Classifier_net.h
...est/resources/target_code/cifar10_cifar10Classifier_net.h
+32
-0
No files found.
.gitignore
0 → 100644
View file @
67385f3d
target
nppBackup
.project
.settings
.classpath
.idea
.git
*.iml
.travis.yml
0 → 100644
View file @
67385f3d
script
:
-
git checkout ${TRAVIS_BRANCH}
-
mvn clean install cobertura:cobertura org.eluder.coveralls:coveralls-maven-plugin:report --settings "settings.xml"
after_success
:
-
if [ "${TRAVIS_BRANCH}" == "master" ]; then mvn -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -B deploy --debug --settings "./settings.xml"; fi
pom.xml
0 → 100644
View file @
67385f3d
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<!-- == PROJECT COORDINATES ============================================= -->
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-emadl-generator
</artifactId>
<version>
0.2.0-SNAPSHOT
</version>
<!-- == PROJECT DEPENDENCIES ============================================= -->
<properties>
<!-- .. SE-Libraries .................................................. -->
<monticore.version>
4.5.4-SNAPSHOT
</monticore.version>
<se-commons.version>
1.7.7
</se-commons.version>
<mc.grammars.assembly.version>
0.0.6-SNAPSHOT
</mc.grammars.assembly.version>
<emadl.version>
0.2.0-SNAPSHOT
</emadl.version>
<SIUnit.version>
0.0.10-SNAPSHOT
</SIUnit.version>
<Common-MontiCar.version>
0.0.11-SNAPSHOT
</Common-MontiCar.version>
<Embedded-MontiArc.version>
0.0.11-SNAPSHOT
</Embedded-MontiArc.version>
<Embedded-MontiArc-Behaviour.version>
0.0.11-SNAPSHOT
</Embedded-MontiArc-Behaviour.version>
<CNNArch.version>
0.2.0-SNAPSHOT
</CNNArch.version>
<CNNTrain.version>
0.2.0-SNAPSHOT
</CNNTrain.version>
<Math.version>
0.0.11-SNAPSHOT
</Math.version>
<Embedded-MontiArc-Math.version>
0.0.11-SNAPSHOT
</Embedded-MontiArc-Math.version>
<embedded-montiarc-math-generator>
0.0.9-SNAPSHOT
</embedded-montiarc-math-generator>
<!-- .. Libraries .................................................. -->
<guava.version>
18.0
</guava.version>
<junit.version>
4.12
</junit.version>
<logback.version>
1.1.2
</logback.version>
<jscience.version>
4.3.1
</jscience.version>
<!-- .. Plugins ....................................................... -->
<monticore.plugin>
4.5.3-SNAPSHOT
</monticore.plugin>
<assembly.plugin>
2.5.4
</assembly.plugin>
<compiler.plugin>
3.3
</compiler.plugin>
<source.plugin>
2.4
</source.plugin>
<shade.plugin>
2.4.3
</shade.plugin>
<!-- Classifiers -->
<grammars.classifier>
grammars
</grammars.classifier>
<cli.classifier>
cli
</cli.classifier>
<!-- .. Misc .......................................................... -->
<java.version>
1.8
</java.version>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<github.global.server>
github
</github.global.server>
</properties>
<dependencies>
<dependency>
<groupId>
org.antlr
</groupId>
<artifactId>
antlr4-runtime
</artifactId>
<version>
4.7.1
</version>
</dependency>
<dependency>
<groupId>
de.se_rwth.commons
</groupId>
<artifactId>
se-commons-logging
</artifactId>
<version>
${se-commons.version}
</version>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
${guava.version}
</version>
</dependency>
<!-- MontiCore Dependencies -->
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-runtime
</artifactId>
<version>
${monticore.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-grammar
</artifactId>
<version>
${monticore.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-grammar
</artifactId>
<version>
${monticore.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.se_rwth.commons
</groupId>
<artifactId>
se-commons-groovy
</artifactId>
<version>
${se-commons.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang
</groupId>
<artifactId>
NumberUnit
</artifactId>
<version>
${SIUnit.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang
</groupId>
<artifactId>
NumberUnit
</artifactId>
<version>
${SIUnit.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
common-monticar
</artifactId>
<version>
${Common-MontiCar.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
common-monticar
</artifactId>
<version>
${Common-MontiCar.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc
</artifactId>
<version>
${Embedded-MontiArc.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc
</artifactId>
<version>
${Embedded-MontiArc.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-behaviour
</artifactId>
<version>
${Embedded-MontiArc-Behaviour.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-behaviour
</artifactId>
<version>
${Embedded-MontiArc-Behaviour.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang
</groupId>
<artifactId>
math
</artifactId>
<version>
${Math.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang
</groupId>
<artifactId>
math
</artifactId>
<version>
${Math.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-math
</artifactId>
<version>
${Embedded-MontiArc-Math.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-math-generator
</artifactId>
<version>
${embedded-montiarc-math-generator}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
cnn-arch
</artifactId>
<version>
${CNNArch.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
cnn-arch
</artifactId>
<version>
${CNNArch.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
cnn-train
</artifactId>
<version>
${CNNTrain.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
cnn-train
</artifactId>
<version>
${CNNTrain.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-deeplearning
</artifactId>
<version>
${emadl.version}
</version>
</dependency>
<dependency>
<groupId>
de.monticore.lang.monticar
</groupId>
<artifactId>
embedded-montiarc-deeplearning
</artifactId>
<version>
${emadl.version}
</version>
<classifier>
${grammars.classifier}
</classifier>
<scope>
provided
</scope>
</dependency>
<!-- .. Test Libraries ............................................... -->
<dependency>
<groupId>
junit
</groupId>
<artifactId>
junit
</artifactId>
<version>
${junit.version}
</version>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
de.monticore
</groupId>
<artifactId>
monticore-runtime
</artifactId>
<version>
${monticore.version}
</version>
<type>
test-jar
</type>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
ch.qos.logback
</groupId>
<artifactId>
logback-classic
</artifactId>
<version>
${logback.version}
</version>
</dependency>
<dependency>
<groupId>
org.jscience
</groupId>
<artifactId>
jscience
</artifactId>
<version>
${jscience.version}
</version>
</dependency>
</dependencies>
<!-- == PROJECT BUILD SETTINGS =========================================== -->
<build>
<plugins>
<plugin>
<artifactId>
maven-deploy-plugin
</artifactId>
<version>
2.8.1
</version>
<configuration>
<altDeploymentRepository>
internal.repo::default::file://${project.build.directory}/external-dependencies
</altDeploymentRepository>
</configuration>
</plugin>
<plugin>
<groupId>
com.github.github
</groupId>
<artifactId>
site-maven-plugin
</artifactId>
<version>
0.12
</version>
<configuration>
<server>
github
</server>
<message>
Maven artifacts for ${project.version} ${project.artifactId}
</message>
<!-- git commit message -->
<noJekyll>
true
</noJekyll>
<!-- disable webpage processing -->
<outputDirectory>
${project.build.directory}/external-dependencies
</outputDirectory>
<!-- matches distribution management repository url above -->
<branch>
refs/heads/master
</branch>
<!-- remote branch name -->
<includes><include>
**/*
</include></includes>
<repositoryName>
external-dependencies
</repositoryName>
<!-- github repo name -->
<repositoryOwner>
EmbeddedMontiArc
</repositoryOwner>
<!-- github username -->
<merge>
true
</merge>
</configuration>
<executions>
<!-- run site-maven-plugin's 'site' target as part of the build's normal 'deploy' phase -->
<execution>
<goals>
<goal>
site
</goal>
</goals>
<phase>
deploy
</phase>
</execution>
</executions>
</plugin>
<!-- MontiCore Generation -->
<plugin>
<groupId>
de.monticore.mojo
</groupId>
<artifactId>
monticore-maven-plugin
</artifactId>
<version>
${monticore.plugin}
</version>
<executions>
<execution>
<goals>
<goal>
generate
</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Other Configuration -->
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<version>
${compiler.plugin}
</version>
<configuration>
<useIncrementalCompilation>
true
</useIncrementalCompilation>
<source>
${java.version}
</source>
<target>
${java.version}
</target>
</configuration>
</plugin>
<plugin>
<artifactId>
maven-assembly-plugin
</artifactId>
<version>
3.1.0
</version>
<executions>
<execution>
<id>
jar-with-dependencies
</id>
<phase>
package
</phase>
<goals>
<goal>
single
</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
de.monticore.lang.monticar.emadl.generator.EMADLGeneratorCli
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>
jar-with-dependencies
</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<!-- Source Jar Configuration -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-source-plugin
</artifactId>
<version>
${source.plugin}
</version>
<executions>
<execution>
<id>
create source jar
</id>
<phase>
package
</phase>
<goals>
<goal>
jar-no-fork
</goal>
</goals>
<configuration>
<excludeResources>
false
</excludeResources>
<includes>
<include>
**/*.java
</include>
<include>
**/*.ftl
</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<version>
2.19.1
</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>
org.eluder.coveralls
</groupId>
<artifactId>
coveralls-maven-plugin
</artifactId>
<version>
4.3.0
</version>
<configuration>
</configuration>
</plugin>
<plugin>
<groupId>
org.codehaus.mojo
</groupId>
<artifactId>
cobertura-maven-plugin
</artifactId>
<version>
2.7
</version>
<configuration>
<format>
xml
</format>
<maxmem>
256m
</maxmem>
<!-- aggregated reports for multi-module projects -->
<aggregate>
true
</aggregate>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>
internal.repo
</id>
<name>
Temporary Staging Repository
</name>
<url>
file://${project.build.directory}/external-dependencies
</url>
</repository>
<snapshotRepository>
<id>
internal.repo
</id>
<url>
file://${project.build.directory}/external-dependencies
</url>
</snapshotRepository>
</distributionManagement>
</project>
src/license/se/license.txt
0 → 100644
View file @
67385f3d
******************************************************************************
MontiCAR Modeling Family, www.se-rwth.de
Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
All rights reserved.
This project is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3.0 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this project. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************
src/main/java/de/monticore/lang/monticar/emadl/generator/AbstractSymtab.java
0 → 100644
View file @
67385f3d
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package
de.monticore.lang.monticar.emadl.generator
;
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.monticar.emadl._symboltable.EMADLLanguage
;
import
de.monticore.lang.monticar.enumlang._symboltable.EnumLangLanguage
;
import
de.monticore.lang.monticar.generator.cpp.converter.MathConverter
;
import
de.monticore.lang.monticar.generator.optimization.ThreadingOptimizer
;
import
de.monticore.lang.monticar.generator.order.nfp.TagBreakpointsTagSchema.TagBreakpointsTagSchema
;
import
de.monticore.lang.monticar.generator.order.nfp.TagDelayTagSchema.TagDelayTagSchema
;
import
de.monticore.lang.monticar.generator.order.nfp.TagExecutionOrderTagSchema.TagExecutionOrderTagSchema
;
import
de.monticore.lang.monticar.generator.order.nfp.TagInitTagSchema.TagInitTagSchema
;
import
de.monticore.lang.monticar.generator.order.nfp.TagMinMaxTagSchema.TagMinMaxTagSchema
;
import
de.monticore.lang.monticar.generator.order.nfp.TagTableTagSchema.TagTableTagSchema
;
import
de.monticore.lang.monticar.generator.order.nfp.TagThresholdTagSchema.TagThresholdTagSchema
;
import
de.monticore.lang.monticar.streamunits._symboltable.StreamUnitsLanguage
;
import
de.monticore.lang.monticar.struct._symboltable.StructLanguage
;
import
de.monticore.lang.tagging._symboltable.TaggingResolver
;
import
de.monticore.symboltable.GlobalScope
;
import
de.monticore.symboltable.Scope
;
import
java.nio.file.Paths
;
import
java.util.Arrays
;
public
class
AbstractSymtab
{
public
static
TaggingResolver
createSymTabAndTaggingResolver
(
String
...
modelPath
)
{
Scope
scope
=
createSymTab
(
modelPath
);
TaggingResolver
tagging
=
new
TaggingResolver
(
scope
,
Arrays
.
asList
(
modelPath
));
TagMinMaxTagSchema
.
registerTagTypes
(
tagging
);
TagTableTagSchema
.
registerTagTypes
(
tagging
);
TagBreakpointsTagSchema
.
registerTagTypes
(
tagging
);
TagExecutionOrderTagSchema
.
registerTagTypes
(
tagging
);
TagInitTagSchema
.
registerTagTypes
(
tagging
);
TagThresholdTagSchema
.
registerTagTypes
(
tagging
);
TagDelayTagSchema
.
registerTagTypes
(
tagging
);
return
tagging
;
}
public
static
Scope
createSymTab
(
String
...
modelPath
)
{
ConstantPortSymbol
.
resetLastID
();
MathConverter
.
resetIDs
();
ThreadingOptimizer
.
resetID
();
ModelingLanguageFamily
fam
=
new
ModelingLanguageFamily
();
EMADLLanguage
montiArcLanguage
=
new
EMADLLanguage
();
fam
.
addModelingLanguage
(
montiArcLanguage
);
fam
.
addModelingLanguage
(
new
StreamUnitsLanguage
());
fam
.
addModelingLanguage
(
new
StructLanguage
());
fam
.
addModelingLanguage
(
new
EnumLangLanguage
());
final
ModelPath
mp
=
new
ModelPath
();
for
(
String
m
:
modelPath
)
{
mp
.
addEntry
(
Paths
.
get
(
m
));
}
LogConfig
.
init
();
//TODO comment for debug output
GlobalScope
scope
=
new
GlobalScope
(
mp
,
fam
);
de
.
monticore
.
lang
.
monticar
.
Utils
.
addBuiltInTypes
(
scope
);
return
scope
;
}
}
src/main/java/de/monticore/lang/monticar/emadl/generator/EMADLGenerator.java
0 → 100644
View file @
67385f3d
/**
*
* ******************************************************************************
* MontiCAR Modeling Family, www.se-rwth.de
* Copyright (c) 2017, Software Engineering Group at RWTH Aachen,
* All rights reserved.
*
* This project is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3.0 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this project. If not, see <http://www.gnu.org/licenses/>.
* *******************************************************************************
*/
package
de.monticore.lang.monticar.emadl.generator
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Splitter
;
import
de.monticore.io.paths.ModelPath
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ComponentSymbol
;
import
de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.ExpandedComponentInstanceSymbol
;
import
de.monticore.lang.math.math._symboltable.MathStatementsSymbol
;
import
de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol
;
import
de.monticore.lang.monticar.cnnarch.generator.CNNArchGenerator
;
import
de.monticore.lang.monticar.cnntrain._symboltable.CNNTrainLanguage
;
import
de.monticore.lang.monticar.cnntrain.generator.CNNTrainGenerator
;
import
de.monticore.lang.monticar.emadl._cocos.EMADLCocos
;
import
de.monticore.lang.monticar.generator.FileContent
;
import
de.monticore.lang.monticar.generator.cpp.ArmadilloHelper
;
import
de.monticore.lang.monticar.generator.cpp.GeneratorCPP
;
import
de.monticore.lang.monticar.generator.cpp.SimulatorIntegrationHelper
;
import
de.monticore.lang.monticar.generator.cpp.TypesGeneratorCPP
;
import
de.monticore.lang.monticar.generator.cpp.converter.TypeConverter
;
import
de.monticore.lang.tagging._symboltable.TaggingResolver
;
import
de.monticore.symboltable.GlobalScope
;
import
de.monticore.symboltable.Scope
;
import
de.se_rwth.commons.Splitters
;
import
de.se_rwth.commons.logging.Log
;
import
freemarker.template.Template
;
import
freemarker.template.TemplateException
;
import
java.io.IOException
;
import
java.io.StringWriter
;
import
java.nio.file.Files
;
import
java.nio.file.Path
;
import
java.nio.file.Paths
;
import
java.util.*
;
public
class
EMADLGenerator
{
public
static
final
String
CNN_HELPER
=
"CNNTranslator"
;
public
static
final
String
CNN_TRAINER
=
"CNNTrainer"
;
private
GeneratorCPP
emamGen
;
public
EMADLGenerator
()
{
emamGen
=
new
GeneratorCPP
();
emamGen
.
useArmadilloBackend
();
emamGen
.
setGenerationTargetPath
(
"./target/generated-sources-emadl/"
);
}
private
String
modelsPath
;
public
String
getModelsPath
()
{
return
modelsPath
;
}
public
void
setModelsPath
(
String
modelsPath
)
{
if
(!(
modelsPath
.
substring
(
modelsPath
.
length
()
-
1
).
equals
(
"/"
))){
this
.
modelsPath
=
modelsPath
+
"/"
;
}
else
{
this
.
modelsPath
=
modelsPath
;
}
}
public
void
setGenerationTargetPath
(
String
generationTargetPath
){
if
(!(
generationTargetPath
.
substring
(
generationTargetPath
.
length
()
-
1
).
equals
(
"/"
))){
getEmamGen
().
setGenerationTargetPath
(
generationTargetPath
+
"/"
);
}
else
{
getEmamGen
().
setGenerationTargetPath
(
generationTargetPath
);
}
}
public
String
getGenerationTargetPath
(){
return
getEmamGen
().
getGenerationTargetPath
();
}
public
GeneratorCPP
getEmamGen
()
{
return
emamGen
;