Aufgrund von Umarbeiten des s3 Storage wird es in GitLab, in nächster Zeit, mögliche Performance-Einbußen geben. Näheres dazu unter: https://maintenance.itc.rwth-aachen.de/ticket/status/messages/43/show_ticket/6670

CNNArch.mc4 2.69 KB
Newer Older
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
1
package de.monticore.lang.monticar;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
2

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
3
grammar CNNArch extends de.monticore.lang.math.Math {
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
4

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
5
    CNNArchCompilationUnit = Architecture;
6

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
7 8
    symbol scope Architecture = "architecture"
                                name:Name& "{"
9
                                declarations:ArchDeclaration*
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
10
                                body:ArchBody "}";
11

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
12
    interface ArchDeclaration;
13
    interface ArchitectureElement;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
14
    interface Variable;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
15

16 17 18 19 20
    IODeclaration implements ArchDeclaration = "def"
                                               (in:"input" | out:"output")
                                               type:ArchType
                                               Name&
                                               (ArrayDeclaration)?;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
21

22
    ArchType implements Type = (ElementType ("^" "{" (Dimension || ",")+ "}")?)?;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
23

24
    Dimension = IOVariable | intLiteral:UnitNumberResolution;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
25

26 27
    IOVariable implements Variable = Name&;

28
    Constant implements Variable = Name& "=" rhs:ArchSimpleExpression;
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
29

30 31 32 33
    MethodDeclaration implements ArchDeclaration = "def"
                                                   Name& "("
                                                   parameters:(Parameter || ",")* ")" "{"
                                                   body:ArchBody "}";
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
34

35
    Parameter implements Variable = Name& ("=" default:ArchSimpleExpression)?;
36

37
    scope ArchBody = elements:(ArchitectureElement || "->")*;
38

39
    IOLayer implements ArchitectureElement = Name& ("[" index:ArchSimpleExpression "]")?;
40

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
41
    MethodLayer implements ArchitectureElement = Name& "(" arguments:(Argument || ",")* ")";
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
42

43
    Argument = Name "=" rhs:ArchExpression;
44

45
    ParallelLayer implements ArchitectureElement = "(" groups:ArchBody "|" groups:(ArchBody || "|")+ ")";
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
46

47
    ArrayAccessLayer implements ArchitectureElement = "[" index:ArchSimpleExpression "]";
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
48

49

50
    ArchExpression = (expression:ArchSimpleExpression | sequence:ArchValueSequence);
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
51

52 53 54
    interface ArchValueSequence;

    ArchParallelSequence implements ArchValueSequence = "[" parallelValues:(ArchSerialSequence || "|")* "]";
55 56 57

    ArchSerialSequence = serialValues:(ArchSimpleExpression || "->")+;

58 59 60
    ArchValueRange implements ArchValueSequence = "[" start:ArchSimpleExpression
                                                  (serial:"->" | parallel:"|")
                                                  ":" end:ArchSimpleExpression "]";
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
61 62


63 64 65
    ArchSimpleExpression = (arithmeticExpression:MathArithmeticExpression
                         | booleanExpression:MathBooleanExpression
                         | tupleExpression:TupleExpression);
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
66

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
67
    TupleExpression implements MathExpression = "(" expressions:MathArithmeticExpression "," expressions:(MathArithmeticExpression || ",")* ")";
Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
68

Thomas Michael Timmermanns's avatar
Thomas Michael Timmermanns committed
69
}