IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Eclipse Modeling Discussion :

Warnings lors de la génération de ma grammaire


Sujet :

Eclipse Modeling

  1. #1
    Candidat au Club
    Inscrit en
    Février 2008
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 6
    Points : 2
    Points
    2
    Par défaut Warnings lors de la génération de ma grammaire
    Bonjour,

    Je travaille sur une grammaire et j'ai des warnings qui interrompent sa génération.

    Voici ma grammaire:[code]

    constraint is INVALID for context ImpliesExpression and type PrimitiveExpression
    constraint is INVALID for context IffExpression and type PrimitiveExpression
    constraint is INVALID for context EqualityExpression and type PrimitiveExpression
    constraint is INVALID for context RelationalExpression and type PrimitiveExpression
    constraint is INVALID for context AdditiveExpression and type PrimitiveExpression
    constraint is INVALID for context MultiplicativeExpression and type PrimitiveExpression
    constraint is null for context ActualParams and type ActualParam
    2066200 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Java heap space
    java.lang.OutOfMemoryError: Java heap space
    at org.eclipse.xtext.util.Tuples.create(Tuples.java:21)
    at org.eclipse.xtext.util.formallang.PdaUtil.filterEdges(PdaUtil.java:440)
    at org.eclipse.xtext.serializer.analysis.ContextTypePDAProvider.createPDA(ContextTypePDAProvider.java:178)
    at org.eclipse.xtext.serializer.analysis.ContextTypePDAProvider.getContextTypePDA(ContextTypePDAProvider.java:188)
    at org.eclipse.xtext.serializer.analysis.SyntacticSequencerPDAProvider.getPDA(SyntacticSequencerPDAProvider.java:604)
    at org.eclipse.xtext.generator.serializer.SyntacticSequencerUtil.getAllPDAs(SyntacticSequencerUtil.java:59)
    at org.eclipse.xtext.generator.serializer.SyntacticSequencerUtil.getAllAmbiguousTransitions(SyntacticSequencerUtil.java:79)
    at org.eclipse.xtext.generator.serializer.SyntacticSequencerUtil.getAllAmbiguousTransitionsBySyntax(SyntacticSequencerUtil.java:90)
    at org.eclipse.xtext.generator.serializer.AbstractSyntacticSequencer.getFileContents(AbstractSyntacticSequencer.java:95)
    at org.eclipse.xtext.generator.serializer.SerializerFragment.generate(SerializerFragment.java:97)
    at org.eclipse.xtext.generator.Xtend2GeneratorFragment.generate(Xtend2GeneratorFragment.java:66)
    at org.eclipse.xtext.generator.Xtend2GeneratorFragment.generate(Xtend2GeneratorFragment.java:59)
    at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:92)
    at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:113)
    at org.eclipse.xtext.generator.Generator.generate(Generator.java:361)
    at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:128)
    at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
    at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
    at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
    at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
    at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
    at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
    Quelqu'un saurait-il m'indiquer ce qui ne va pas ?

    Merci d'avance pour votre aide.

  2. #2
    Rédacteur/Modérateur

    Avatar de alain.bernard
    Homme Profil pro
    Ingénieur aéronautique
    Inscrit en
    Décembre 2011
    Messages
    749
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur aéronautique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Décembre 2011
    Messages : 749
    Points : 5 219
    Points
    5 219
    Par défaut
    Bonsoir,

    Je n'ai fait que regarder succinctement ta grammaire mais je peux peut-être proposer une piste. Si je regarde la règle "ImpliesExpression" sur laquelle survient une des erreurs je lis : "ImpliesExpression : => IffExpression ( "-> "Iff=IffExpression )* ;"
    Ici je me demande si tu es bien obligé de mettre le symbole '=>'. Pour moi il est requis en cas de possible indétermination lors du parsing, or ici il n'y a pas d'indétermination.

    Pour la règle : "ActualParams :'{ActualParams}' (=> ActualParam ( ","tua=ActualParam )* )? ;", normalement il n'y a pas de quotes autour des accolades. Elles sont là pour forcer l'instanciation d'ActualParams, si tu mets des quotes, Xtext comprendre que l'utilisateur doit taper {ActualParams}

    De manière générale, vu la taille de ta grammaire, je te conseille d'y aller pas à pas. Commence par les briques de base, vérifies la génération, et rajoute ensuite les briques plus complexes au fur et à mesure. C'est une technique que j'avais adoptée alors que je pensais me trouver dans une impasse, et ça avait plutôt bien marché.

    Bon courage
    Alain
    Pas de messages techniques par MP, les forums sont là pour ça.
    Rédacteur d'articles sur la plateforme Eclipse

    N'oubliez pas de consulter les FAQ Eclipse et les cours et tutoriels Eclipse

  3. #3
    Candidat au Club
    Inscrit en
    Février 2008
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 6
    Points : 2
    Points
    2
    Par défaut
    Bonjour,

    J'ai fait selon votre conseil, je suis allé pas à pas en discriminant une grande partie, voila ma grammaire simplifiée :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    grammar org.xtext.Armani with org.eclipse.xtext.common.Terminals
     
    generate armani "http://www.xtext.org/Armani"
     
     
     
    ArmaniGrammar:
         typ+=TypeDeclaration *
      |  fam+=FamilyDeclaration * ;
     // |  des+=DesignRule * 
      //|  sys=SystemDeclaration ?;
     
     
    FamilyDeclaration :
     
    "Family" name=ID  " ="
       (fam= FamilyBody)?;
     
     
     
    FamilyBody :
     
    {FamilyBody}
    "{" (typdec+=TypeDeclaration )* " }" ;
     
     
     
    TypeDeclaration :  ElementTypeDeclaration  |  PropertyTypeDeclaration ;    
     
    ElementTypeDeclaration  :  ComponentTypeDeclaration |  ConnectorTypeDeclaration |  PortTypeDeclaration 
    |  RoleTypeDeclaration  ;
     
     
    ComponentTypeDeclaration :   'Component Type' name=ID  " =" p=[ parse_ComponentDescription ]  
                               | 'Component Type' namee=ID  'Extends'  nameee=ID ( ","ID )* 'With' pre = [parse_ComponentDescription] ;
     
    ConnectorTypeDeclaration  : 'Connector Type'  name=ID   "=" ID  
                               | 'Connector Type' name=ID  'Extends'  namee=ID ( ","ID  )* 'With'ID ;
     
     
    PortTypeDeclaration  : 'Port Type' name=ID "=" ID
                          | 'Port Type' namee=ID 'Extends' nameee=ID ( ","ID  )* 'With' ID;
     
     
    RoleTypeDeclaration : 'Role Type' name=ID "=" ID 
                          | 'Role Type' namee=ID 'Extends'nameeee=ID ( ","ID  )* 'With'ID;
     
    lookup_ComponentTypeByName  : name=ID ;  
    lookup_ConnectorTypeByName   : name=ID ; 
    lookup_PortTypeByName   : name=ID ; 
    lookup_RoleTypeByName   : name=ID ; 
    lookup_PropertyTypeByName    : name=ID ; 
    lookup_arbitraryTypeByName : name=ID ; 
     
    PropertyTypeDeclaration  : 
        {PropertyTypeDeclaration} =>'Property Type'   ID
    (  ";"  |  
    "=" ( 'INT'";" | 'Long'";" | 'Double'";" | 'Float'";"
       |'String'";" | 'Boolean'";" | 'Any'";"
       |'Enum' ( "{"  ID  ( ","ID  )* "}" )* ";"
       |'Set' ( "{""}" )? ";"
       |'Set'"{"  p=[PropertyTypeDeclaration] "}"";"
       |'Sequence'  ( "<"">" ) ";"
       |'Sequence'"<"  p=[PropertyTypeDescription ]">"";"
       |'Record'"["  Record=ID    
           ( ";"ID | ";" )* "]"";"
       |'Record' ( "[""]" )? ";"
       |Identifier=ID";"
             )
     ) ;
     
    PropertyTypeDescription  :
        {PropertyTypeDescription} => 'INT'  |  'Long'  |  'Float'  |  'Double' |  'String '
    | ' Boolean' |  'Any'
    |  'Set'  ( "{" (  p=[PropertyTypeDeclaration] )? "}" )?  
    |  'Sequence'  ( "<" ( p=[PropertyTypeDeclaration]  ) ">" ) 
    |'Record '"["  pRecordField=ID ( ";"ID | ";" )* "]"
    |  'Record' ( "[""]" )?
    |  'Enum'  ( "{" Idenifier=ID  ( ","ID  )* "}")? 
    |  'Enum'  ( "{""}" ) 
    |  Identfer=ID;
     
    parse_ComponentDescription  : (  'New' lookup_ComponentTypeByName  |  
    "{"  //(  port=[PortDeclaration] | PB=[ PortsBlock]  | a=[ PropertyDeclaration]   | pm=[ PropertiesBlock]
          //| r=[ RepresentationDeclaration  ]|  d=[ DesignRule] )* 
          //| r=[ RepresentationDeclaration  ] )* 
    "}"
           )  
        ('Extended With'  p=[parse_ComponentDescription] );
    Voilà ce que ça génère comme warnings :
    warning(200): ../org.xtext.armani/src-gen/org/xtext/parser/antlr/internal/InternalArmani.g:80:1: Decision can match input such as "EOF" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    Semantic predicates were present but were hidden by actions.
    avec :
    *Build path specifies execution environment J2SE-1.5. There are no JREs installed in the workspace that are strictly compatible with this environment.

    *Discouraged access: The type IPartialContentAssistParser is not accessible due to restriction on required library
    *The file "plugin.xml" does not exist in the workspace
    Merci de votre aide.

  4. #4
    Candidat au Club
    Inscrit en
    Février 2008
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 6
    Points : 2
    Points
    2
    Par défaut
    Bonjour,

    J'ai pris un exemple de ma grammaire en faisant un test mais à chaque appel à un type déclaré, ça génère des erreurs:

    Voici un portion de ma grammaire:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    PropertyTypeDeclaration  : 
        {PropertyTypeDeclaration} 'Property Type'   name=ID (  ";"  |"="  ("INT;" | "Long;" | "Double;" | "Float;"|"String;" | "Boolean;" | "Any;"
       |'Enum' ( "{"  ID  ( ","ID  )* "}" )* ";"
       |'Set' ( "{""}" )? ";"
       |"Set{"  p=[PropertyTypeDescription]"}"";"
       |'Sequence'  ( "<"">" ) ";"
       |'Sequence'"<"  p=[PropertyTypeDescription ]">"";"
       |'Record'"[" gv=[parse_RecordFieldDescription]  ( ";"
     uj=[parse_RecordFieldDescription ]| ";" )* "]"";"
       |'Record' ( "[""]" )? ";"
       |Identifier=ID";"
           ))  
      ;
     
     
     
     
    PropertyTypeDescription  :
        {PropertyTypeDescription}  'INT'  |  'Long'  |  'Float'  |  'Double' |  'String '
    | ' Boolean' |  'Any'
    |  'Set'"{"  (   p=[PropertyTypeDescription]   )? "}" 
    |  'Sequence'  ( "<"  p=[PropertyTypeDescription]   ">" ) 
    |'Record'"[" gv=[parse_RecordFieldDescription]  ( ";"
     uj=[parse_RecordFieldDescription ]| ";" )* "]"";"
    |  'Record' ( "[""]" )?
    |  'Enum'  ( "{" Idenifier=ID  ( ","ID  )* "}")? 
    |  'Enum'  ( "{""}" ) 
    |  Identfer=ID;
    et voici les erreurs qu'elle génère lors de l'instantiation de cet exemple:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    Property Type PrecService= Enum{activer,abandonner,annuler,compenser,echouer,terminer,rejouer};
        Property Type legalSoapVersions= Enum {SOAP1_1,SOAP1_2};
        Property Type legalTransportProtocols= Enum {HTTP1_0,HTTP1_1};
        Property Type SafeBoolean= Enum {Yes,No};
        Property Type EtatService= Enum {rejouable,compensable,pivot};
        Property Type Interfaces= Enum {Client,Service};
        Property Type messagePatterns= Set{validExchange};
        Property Type message= Record [ST: String ; DT : String; ];
        Property Type validExchange= Sequence < message >;
        Property Type EndPoint= Record [Transport: legalTransportProtocols; Encoding : legalSoapVersions; ];
        Property Type EndPoints= Set{EndPoint};
     
     
        Property Type WsdlDocs= Set{String};
    les erreurs :
    Couldn't resolve reference to PropertyTypeDescription 'validExchange'.
    Multiple markers at this line
    - mismatched input ':' expecting ']'
    - Couldn't resolve reference to parse_RecordFieldDescription
    'ST'.
    Couldn't resolve reference to PropertyTypeDescription 'message'.
    Multiple markers at this line
    - Couldn't resolve reference to parse_RecordFieldDescription
    'Transport'.
    - mismatched input ':' expecting ']'

    Couldn't resolve reference to PropertyTypeDescription 'EndPoint'.
    Couldn't resolve reference to PropertyTypeDescription 'String'.
    Merci infiniment de votre aide.

  5. #5
    Rédacteur/Modérateur

    Avatar de alain.bernard
    Homme Profil pro
    Ingénieur aéronautique
    Inscrit en
    Décembre 2011
    Messages
    749
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur aéronautique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Décembre 2011
    Messages : 749
    Points : 5 219
    Points
    5 219
    Par défaut
    Bonsoir,

    A première vue, je propose l'hypothèse suivante : visiblement il y a une erreur au niveau de la ligne :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Property Type messagePatterns= Set{validExchange};
    Ta grammaire déclare qu'une déclaration de Set dans un PropertyType est la suivante :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    'Property Type'   name=ID [...]
       "Set{"  p=[PropertyTypeDescription]"}"";" [...]
    Donc validExchange (p dans la règle) doit être un élément de type PropertyTypeDescription. Or dans l'exemple validExchange vaut :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     Property Type validExchange= Sequence < message >;
    Ce n'est donc pas un élément de type PropertyTypeDescription puisqu'il commence par l'item 'Property Type' ! Je te propose donc de chercher dans cette voie
    Pas de messages techniques par MP, les forums sont là pour ça.
    Rédacteur d'articles sur la plateforme Eclipse

    N'oubliez pas de consulter les FAQ Eclipse et les cours et tutoriels Eclipse

  6. #6
    Expert confirmé
    Avatar de Hephaistos007
    Profil pro
    Enseignant Chercheur
    Inscrit en
    Décembre 2004
    Messages
    2 493
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Enseignement

    Informations forums :
    Inscription : Décembre 2004
    Messages : 2 493
    Points : 4 166
    Points
    4 166
    Par défaut
    Les trucs dans le genre me semble bizarre, surtout connaissant l'ADL Armani/Acme :
    Code xtext : Sélectionner tout - Visualiser dans une fenêtre à part
    ConnectorTypeDeclaration  : 'Connector Type'  name=ID   "=" ID

    De manière générale, je pense que tu as un manque de rigueur dans l'écriture de tes règles. Par exemple, des fois il y a des espaces, des fois non. Il faut "compiler" ta grammaire pas-à-pas parce que là ca va être difficile de corriger tes erreurs.

    D'autre part, j'anticipe ton travail : l'ADL Armani/Acme permet de définir des types puis des instances. Charge à toi de vérifier que les instances définies sont conformes à leur type. Sur cet aspect, tu peux déjà jeter un oeil à l'avant dernière diapo de mon cours sur Xtext.
    Il vaut mieux mobiliser son intelligence sur des conneries que mobiliser sa connerie sur des choses intelligentes --- devise SHADOKS

    Kit de survie Android : mon guide pour apprendre à programmer sur Android, mon tutoriel sur les web services et enfin l'outil en ligne pour vous faire gagner du temps - N'oubliez pas de consulter la FAQ Android

  7. #7
    Candidat au Club
    Inscrit en
    Février 2008
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 6
    Points : 2
    Points
    2
    Par défaut
    Merci, infiniment pour vos conseils !

    J'ai essayé de corriger un peu plus ma grammaire car c'est vrai qu'elle est ambiguë.
    J'ai essayé avant diverses manières mais celle-ci me parait plus rigoureuse. Enfin j’espère l'achever jusqu'à la fin mais j'ai du mal à m'en sortir...

    Je croyais avoir corrigé ma grammaire mais lorsque j’ai instancié un exemple, il s’avère qu’il existe beaucoup de fautes que je ne comprends pas.

    Voici une portion :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    FamilyDeclaration :
     
    "Family" name=ID  " ="
       (fam= FamilyBody)?;
     
     
     
    FamilyBody :
     
    {FamilyBody}
    "{" (typdec+=TypeDeclaration )* "}" ;
     
     
     
    TypeDeclaration :  ElementTypeDeclaration  |  PropertyTypeDeclaration ;    
     
    ElementTypeDeclaration  :  ComponentTypeDeclaration |  ConnectorTypeDeclaration |  PortTypeDeclaration 
    |  RoleTypeDeclaration  ;
     
     
    ComponentTypeDeclaration : {ComponentTypeDeclaration}  'Component Type' name=ID  "= {}"
                               | 'Component Type' name=ID  "="  p=[parse_ComponentDescription]
                               | 'Component Type' namee=ID  'Extends' co=[ComponentTypeDeclaration] "With" pre=[parse_ComponentDescription] ;
     
     
    parse_ComponentDescription  :  "{"( po=[PortDeclaration] |PB=[ PortsBlock]| a=[ PropertyDeclaration]| pm=[ PropertiesBlock]| d=[ DesignRule] "}")*;  
     // ('Extended With'  p=[parse_ComponentDescription] )*;  'New' l=[lookup_ComponentTypeByName]";"
     
     
    ConnectorTypeDeclaration  : 
    {ConnectorTypeDeclaration} 'Connector Type'  name=ID   "=" pD=[ parse_ConnectorDescription ]  
                               | 'Connector Type' name=ID  'Extends'  nh=[ConnectorTypeDeclaration]  'With' p=[ parse_ConnectorDescription ]  ;
     
     
    parse_ConnectorDescription  :   (  'New' lookup_ConnectorTypeByName   
         |  
    "{"(   g= [RoleDeclaration] | r=[RolesBlock] | pz=[PropertyDeclaration]
                  | pro=[PropertiesBlock ]
                 // |r=[ RepresentationDeclaration ])
                 // |  d=[DesignRule] )*  
    "}"
         )  )
        (' Extended With'p=[ parse_ConnectorDescription] );
     
     
    PortTypeDeclaration  : {PortTypeDeclaration} "Port Type" ID "="  pD=[ parse_PortDescription ]
                          | "Port Type" name=ID 'Extends' na=[PortTypeDeclaration]  "With"  pD=[ parse_PortDescription ];
     
     
    parse_PortDescription  :"{" (h=[PropertyDeclaration] | pr=[PropertiesBlock])* "}"| 'New' l=[lookup_PortTypeByName];
             // | r=[RepresentationDeclaration] | d=[DesignRule]  )*  
             //)*  
     
     
    lookup_ComponentTypeByName  : name=ID ;  
    lookup_ConnectorTypeByName   : name=ID ; 
    lookup_PortTypeByName   : name=ID ; 
    lookup_RoleTypeByName   : name=ID ; 
    lookup_PropertyTypeByName    : name=ID ; 
    lookup_arbitraryTypeByName : name=ID ; 
     
    PropertyTypeDeclaration  : 
        {PropertyTypeDeclaration} 'Property Type'   name=ID (  ";"  |"="  ("INT;" | "Long;" | "Double;" | "Float;"|"String;" | "Boolean;" | "Any;"
       |'Enum' ( "{"  ID  ( ","ID  )* "}" )* ";"
       |'Set' "{""}" ";"
       |"Set"  '{' p=[PropertyTypeDeclaration]"}"";"
       |'Sequence'  ( "<"">" ) ";"
       |'Sequence'"<"  p=[PropertyTypeDeclaration ]">"";"
       |'Record'"[" ID   ( ","ID )* ":"  p=[PropertyTypeDeclaration] ";" ( ID   ( ","ID )* ":"  p=[PropertyTypeDeclaration]  ";" )* "]"";"
       |'Record' ( "[""]" )? ";"
       |Identifier=ID";"
           ))  
      ;
     
     
    PortDeclaration  :{PortDeclaration}  'Port' name=ID  ":"  look=[lookup_PortTypeByName] ( "=" p=[parse_PortDescription ] ";" | ";" ) ;
     
     
    PortsBlock: {PortsBlock} 'Ports'"{" ID
        ( ":"look=lookup_PortTypeByName  )? 
        ( "=" p=[parse_PortDescription]";" | ";" ) * 
    "}" ;
     
     
    PropertyDeclaration  :{PropertyDeclaration}  "Property" p=[parse_PropertyDescription]  ";" ;
     
    PropertiesBlock  : 'Properties'"{"
       p= [parse_PropertyDescription]
        ( ";"pedd=[parse_PropertyDescription] | ";" )*  
     
    "}" ;
     
    parse_PropertyDescription  :   name=ID  ":" proper=[PropertyTypeDescription ]";";
    Et voici l’exemple que je veux instancier, le problème étant que lorsque je veux ajouter un port dans un composant ou une propriété dans un port, il ne lit pas « Property » tout court ou « Port » tout court. Il me demande toujours d’ajouter le T venant de Type alors que j’ai bien défini les portsdeclaration ou property declaration.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    Family FamilyInit = {
     
      // defintion of components Type  
     
        Component Type CompTWSCommon = {
            rule NameUnique = invariant forall p1 : PortTWSCommon in self.PORTS | 
                forall p2 : PortTWSCommon in self.PORTS | 
                    (p1 != p2) -> p1.name != p2.name;
        }
     
        Component Type MedAndJoin extends CompTWSMediateur with {
            rule x = invariant forall p : PortTWSClient in self.PORTS | 
                p.Prec == activer;
            rule y = invariant forall p : PortTWSService in self.PORTS | 
                p.Prec == terminer;
     
        }
     
     
        Component Type CompTWSMediateur extends CompTWSCommon with {
            rule rule29 = invariant forall p : Port in self.PORTS | 
                satisfiesType(p, PortTWSClient) OR satisfiesType(p, PortTWSService);
            rule aumoinsInterface = invariant size(self.PORTS) >= 2;
     
        }
        Component Type MedAndSplit extends CompTWSMediateur with {
            rule x = invariant forall p : PortTWSClient in self.PORTS | 
                p.Prec == terminer;
            rule y = invariant forall p : PortTWSService in self.PORTS | 
                p.Prec == activer;
     
        }
     
     
        Component Type CompTWSService extends CompTWSCommon with {
            rule rule27 = invariant forall p : Port in self.PORTS | 
                satisfiesType(p, PortTWSService) ;
            rule rule28 = invariant size(self.PORTS) > 0;
     
        }
        Component Type CompTWSClient extends CompTWSCommon with {
            rule rule25 = invariant forall p : Port in self.PORTS | 
                satisfiesType(p, PortTWSClient) ;
            rule rule26 = invariant size(self.PORTS) > 0 ;
     
        }
     
        // defintion of connector Type 
     
        Connector Type ConnTWS = {
            rule rule19 = invariant size(self.ROLES) == 2 ;
            rule rule20 = invariant forall r1 : Role in self.ROLES | 
                forall r2 : Role in self.ROLES | 
                    forall p1 : PortTWSCommon in r1.ATTACHEDPORTS | 
                        forall p2 : PortTWSCommon in r2.ATTACHEDPORTS | 
                            (r1 != r2 AND attached(r1, p1) AND attached(r2, p2)) -> size(intersection(p1.EndPointList, p2.EndPointList)) > 0 ;
            rule rule21 = heuristic forall r1 : Role in self.ROLES | 
                forall r2 : Role in self.ROLES | 
                    forall p1 : PortTWSCommon in r1.ATTACHEDPORTS | 
                        forall p2 : PortTWSCommon in r2.ATTACHEDPORTS | 
                            (r1 != r2 AND attached(r1, p1) AND attached(r2, p2)) -> ( ! ((p1.InOurControlDomain == Yes AND ( ! (isSubset(p1.MessageExchangePatterns, p2.MessageExchangePatterns))) AND isSubset(p2.MessageExchangePatterns, p1.MessageExchangePatterns)) OR (p2.InOurControlDomain == Yes AND ( ! (isSubset(p2.MessageExchangePatterns, p1.MessageExchangePatterns))) AND isSubset(p1.MessageExchangePatterns, p2.MessageExchangePatterns)))) ;
     
        }
     
     // definition of port Type    
        Port Type PortTWSCommon = {
     
            Property Etat : EtatService;
     
        }
        Port Type PortTWSClient = {
     
            Property EndPointList : EndPoints;
     
            Property InInterface : Interfaces = Client;
     
            Property InOurControlDomain : SafeBoolean ;
     
            Property MessageExchangePatterns : messagePatterns;
     
            Property Prec : PrecService;
     
            Property SendsFirstMessage : SafeBoolean;
            rule rule6 = invariant size(EndPointList) > 0 ;
     
        }
     
        Port Type PortTWSService = {
     
            Property InInterface : Interfaces = Service;
     
            Property InOurControlDomain : SafeBoolean ;
     
            Property Prec : PrecService;
     
            Property MessageExchangePatterns : messagePatterns;
     
            Property EndPointList : EndPoints;
     
            Property SendsFirstMessage : SafeBoolean;
     
            Property EndPointAddressList : EndPointAddresses;
     
            Property WsdlDocRefs : WsdlDocs;
            rule rule11 = invariant size(EndPointList) > 0 ;
        }
    }
    Lorsque j'instancie un composant type ou un port Type il signale ceci :
    Multiple markers at this line
    - no viable alternative at input 'Port Type'
    - mismatched character 'P' expecting '}'
    Merci de vos remarques et aides.

  8. #8
    Candidat au Club
    Inscrit en
    Février 2008
    Messages
    6
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 6
    Points : 2
    Points
    2
    Par défaut Similarité de noms dans une grammaire
    Bonjour,

    Je propose de définir dans ma grammaire un "Property Type" exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    PropertyTypeDeclaration  : 
    	{PropertyTypeDeclaration} 'Property Type'   name=ID (  ";"  |"="  ("INT;" | "Long;" | "Double;" | "Float;"|"String;" | "Boolean;" | "Any;"
       |'Enum' ( "{"  ID  ( ","ID  )* "}" )* ";"
       |'Set' "{""}" ";"
       |"Set"  '{' p=[PropertyTypeDeclaration]"}"";"
       |'Sequence'  ( "<"">" ) ";"
       |'Sequence'"<"  p=[PropertyTypeDeclaration ]">"";"
       |'Record'"[" ID   ( ","ID )* ":"  p=[PropertyTypeDeclaration] ";" ( ID   ( ","ID )* ":"  p=[PropertyTypeDeclaration]  ";" )* "]"";"
       |'Record' ( "[""]" )? ";"
       |Identifier=ID";"
           ))  
      ;
    De plus quand je définit également un port Type j'ai besoin d'instancier des "property" de type "Property Type" comme le montre le bout de code:


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    PortTypeDeclaration  : {PortTypeDeclaration} "Port Type" name=ID "= {}"
                          | "Port Type" name=ID   "= {"(h+=PropertyDeclaration)*"}";
     
    PropertyDeclaration  : 'Property' name=ID  ":" proper=[PropertyTypeDeclaration ]";";
    Maintennat lorsque j'instancie un exemple y pas de probleme pour le mot cle "Property Type" mais quand je definit un port Type dont je veux mettre des "propriétés, ce dernier n'accepte pas le mot clé "property" tout court, le générateur attend toujours à ce que j'ajoute le mot Type Hors dans ma syntaxe j'en ai pas besoin. En revanche quand je modifie le mot clé property par un autre mot ça marche.
    Que faire j'ai besoin de ces terminaux.
    Merci.

Discussions similaires

  1. [Images] Génération de l'image : obtention de caractères bizares
    Par Metallic-84s dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 27/02/2006, 09h07
  2. JDBC warning lors de la compilation
    Par kichemans dans le forum JDBC
    Réponses: 5
    Dernier message: 27/12/2005, 15h40
  3. Warning lors la creation d'une classe
    Par addack dans le forum Langage
    Réponses: 11
    Dernier message: 02/11/2005, 12h06
  4. [JAXB][XSD] Problème lors de la génération des classes
    Par charlot44 dans le forum Persistance des données
    Réponses: 4
    Dernier message: 22/06/2005, 16h10
  5. Warnings lors de la compilation
    Par polo54 dans le forum C
    Réponses: 5
    Dernier message: 07/02/2003, 09h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo