Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
monticore
EmbeddedMontiArc
languages
CNNArchLang
Commits
83da7562
Commit
83da7562
authored
Aug 09, 2018
by
Svetlana Pavlitskaya
Browse files
Fixed issue with ASTRange
parent
3bfb1407
Pipeline
#67573
failed with stages
in 11 minutes and 43 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckArgument.java
View file @
83da7562
...
...
@@ -31,7 +31,7 @@ public class CheckArgument implements CNNArchASTArchArgumentCoCo {
@Override
public
void
check
(
ASTArchArgument
node
)
{
ArgumentSymbol
argument
=
(
ArgumentSymbol
)
node
.
getSymbol
().
get
();
ArgumentSymbol
argument
=
(
ArgumentSymbol
)
node
.
getSymbol
Opt
().
get
();
LayerDeclarationSymbol
layerDeclaration
=
argument
.
getLayer
().
getDeclaration
();
if
(
layerDeclaration
!=
null
&&
argument
.
getParameter
()
==
null
){
Log
.
error
(
"0"
+
ErrorCodes
.
UNKNOWN_ARGUMENT
+
" Unknown Argument. "
+
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckLayer.java
View file @
83da7562
...
...
@@ -50,9 +50,9 @@ public class CheckLayer implements CNNArchASTLayerCoCo{
}
}
LayerDeclarationSymbol
layerDeclaration
=
((
LayerSymbol
)
node
.
getSymbol
().
get
()).
getDeclaration
();
LayerDeclarationSymbol
layerDeclaration
=
((
LayerSymbol
)
node
.
getSymbol
Opt
().
get
()).
getDeclaration
();
if
(
layerDeclaration
==
null
){
ArchitectureSymbol
architecture
=
node
.
getSymbol
().
get
().
getEnclosingScope
().<
ArchitectureSymbol
>
resolve
(
""
,
ArchitectureSymbol
.
KIND
).
get
();
ArchitectureSymbol
architecture
=
node
.
getSymbol
Opt
().
get
().
getEnclosingScope
().<
ArchitectureSymbol
>
resolve
(
""
,
ArchitectureSymbol
.
KIND
).
get
();
Log
.
error
(
"0"
+
ErrorCodes
.
UNKNOWN_LAYER
+
" Unknown layer. "
+
"Layer with name '"
+
node
.
getName
()
+
"' does not exist. "
+
"Existing layers: "
+
Joiners
.
COMMA
.
join
(
architecture
.
getLayerDeclarations
())
+
"."
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_cocos/CheckLayerRecursion.java
View file @
83da7562
...
...
@@ -39,7 +39,7 @@ public class CheckLayerRecursion implements CNNArchASTLayerDeclarationCoCo {
@Override
public
void
check
(
ASTLayerDeclaration
node
)
{
done
=
false
;
LayerDeclarationSymbol
layerDeclaration
=
(
LayerDeclarationSymbol
)
node
.
getSymbol
().
get
();
LayerDeclarationSymbol
layerDeclaration
=
(
LayerDeclarationSymbol
)
node
.
getSymbol
Opt
().
get
();
checkForRecursion
(
layerDeclaration
,
layerDeclaration
.
getBody
());
}
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/ArchTypeSymbol.java
View file @
83da7562
...
...
@@ -20,7 +20,11 @@
*/
package
de.monticore.lang.monticar.cnnarch._symboltable
;
import
de.monticore.lang.monticar.ranges._ast.ASTRange
;
import
de.monticore.lang.monticar.ranges._ast.ASTRangeStepResolution
;
import
de.monticore.lang.monticar.resolution._ast.ASTUnitNumberResolution
;
import
de.monticore.lang.monticar.types2._ast.ASTElementType
;
import
de.monticore.numberunit._ast.ASTNumberWithUnit
;
import
de.monticore.symboltable.CommonSymbol
;
import
de.monticore.symboltable.MutableScope
;
import
de.monticore.symboltable.Scope
;
...
...
@@ -244,7 +248,11 @@ public class ArchTypeSymbol extends CommonSymbol {
}
public
Builder
elementType
(
String
start
,
String
end
){
domain
=
new
ASTElementType
();
domain
.
setName
(
"Q("
+
start
+
":"
+
end
+
")"
);
domain
.
setName
(
"Q"
);
//("Q(" + start + ":" + end +")");
ASTRange
range
=
new
ASTRange
();
range
.
setStartValue
(
start
);
range
.
setEndValue
(
end
);
domain
.
setRange
(
range
);
return
this
;
}
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/CNNArchSymbolTableCreator.java
View file @
83da7562
...
...
@@ -144,7 +144,7 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
}
public
void
endVisit
(
final
ASTArchitecture
node
)
{
//ArchitectureSymbol architecture = (ArchitectureSymbol) node.getSymbol().get();
//ArchitectureSymbol architecture = (ArchitectureSymbol) node.getSymbol
Opt
().get();
architecture
.
setBody
((
ArchitectureElementSymbol
)
node
.
getBody
().
getSymbolOpt
().
get
());
removeCurrentScope
();
...
...
@@ -224,7 +224,7 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
@Override
public
void
endVisit
(
ASTLayerDeclaration
ast
)
{
LayerDeclarationSymbol
layerDeclaration
=
(
LayerDeclarationSymbol
)
ast
.
getSymbol
().
get
();
LayerDeclarationSymbol
layerDeclaration
=
(
LayerDeclarationSymbol
)
ast
.
getSymbol
Opt
().
get
();
layerDeclaration
.
setBody
((
CompositeElementSymbol
)
ast
.
getBody
().
getSymbolOpt
().
get
());
List
<
VariableSymbol
>
parameters
=
new
ArrayList
<>(
4
);
...
...
@@ -259,7 +259,7 @@ public class CNNArchSymbolTableCreator extends de.monticore.symboltable.CommonSy
if
(
ast
.
isPresentArithmeticExpression
())
{
ASTExpression
arithmeticExpression
=
ast
.
getArithmeticExpression
();
if
(
arithmeticExpression
.
isPresentSymbol
())
{
mathExp
=
(
MathExpressionSymbol
)
arithmeticExpression
.
getSymbol
().
get
();
mathExp
=
(
MathExpressionSymbol
)
arithmeticExpression
.
getSymbol
Opt
().
get
();
}
}
else
if
(
ast
.
isPresentBooleanExpression
())
{
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/LayerSymbol.java
View file @
83da7562
...
...
@@ -257,7 +257,8 @@ public class LayerSymbol extends ArchitectureElementSymbol {
public
List
<
ArchTypeSymbol
>
computeOutputTypes
()
{
if
(
getResolvedThis
().
isPresent
())
{
if
(
getResolvedThis
().
get
()
==
this
)
{
return
((
PredefinedLayerDeclaration
)
getDeclaration
()).
computeOutputTypes
(
getInputTypes
(),
this
);
List
<
ArchTypeSymbol
>
inputTypes
=
getInputTypes
();
return
((
PredefinedLayerDeclaration
)
getDeclaration
()).
computeOutputTypes
(
inputTypes
,
this
);
}
else
{
return
getResolvedThis
().
get
().
getOutputTypes
();
...
...
src/main/java/de/monticore/lang/monticar/cnnarch/_symboltable/PredefinedLayerDeclaration.java
View file @
83da7562
...
...
@@ -190,8 +190,6 @@ abstract public class PredefinedLayerDeclaration extends LayerDeclarationSymbol
}
protected
List
<
String
>
computeStartAndEndValue
(
List
<
ArchTypeSymbol
>
inputTypes
,
BinaryOperator
<
Rational
>
startValAccumulator
,
BinaryOperator
<
Rational
>
endValAccumulator
){
boolean
noStartValues
=
true
;
boolean
noEndValues
=
true
;
Stream
.
Builder
<
Rational
>
startValues
=
Stream
.
builder
();
Stream
.
Builder
<
Rational
>
endValues
=
Stream
.
builder
();
String
start
=
null
;
...
...
@@ -203,22 +201,20 @@ abstract public class PredefinedLayerDeclaration extends LayerDeclarationSymbol
start
=
"-oo"
;
}
else
{
noStartValues
=
false
;
startValues
.
add
(
range
.
get
().
getStartValue
());
}
if
(
range
.
get
().
hasNoUpperLimit
()){
end
=
"oo"
;
}
else
{
noEndValues
=
false
;
endValues
.
add
(
range
.
get
().
getEndValue
());
}
}
}
if
(
start
==
null
&&
!
noStartValues
){
if
(
start
==
null
){
start
=
""
+
startValues
.
build
().
reduce
(
startValAccumulator
).
get
().
doubleValue
();
}
if
(
end
==
null
&&
!
noEndValues
){
if
(
end
==
null
){
end
=
""
+
endValues
.
build
().
reduce
(
endValAccumulator
).
get
().
doubleValue
();
}
...
...
src/test/resources/invalid_tests/MissingMerge.cnna
View file @
83da7562
architecture MissingMerge(inputs=10, classes=2){
def input Q(-oo:+oo)^{
inputs
} in1
def output Q(0:1)^{
classes
} out1
def input Q(-oo:+oo)^{
10
} in1
def output Q(0:1)^{
2
} out1
in1 ->
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment