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 Platform Discussion :

Grammaire Xtext sous Eclipse


Sujet :

Eclipse Platform

  1. #1
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Janvier 2014
    Messages
    4
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Biens de consommation

    Informations forums :
    Inscription : Janvier 2014
    Messages : 4
    Points : 4
    Points
    4
    Par défaut Grammaire Xtext sous Eclipse
    Bonjour,

    Je suis en train de développer une grammaire sous Xtext présentée ci-dessous:
    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
    grammar org.xtext.System with org.eclipse.xtext.common.Terminals
     
    generate system "http://www.xtext.org/System"
    import "http://www.eclipse.org/emf/2002/Ecore" as ecore
     
    Acme:
        system+=SYSTEM*
      family+=FAMILY*;
    SYSTEM :  'System '  name=ID '=' 
          Ouvert1=Ouverture
        (Comp+=Component)*
         (conn+=Connector)* 
     
        ferm1=Fermeture ;
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Component: Component1|Component2|Component3;
    Component1:name=ID ':' name1=CHAINE'=  new ' name3=CHAINE ';';
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Component2:
    'Component' name=ID '='
       ouvert2=Ouverture
      (port+=Port)*
      (prop+=ProprietyC)
         ferm2=Fermeture;
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    
         Component3: name=ID ':' name1=CHAINE ;
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Port: Port1|Port2;
    Port1: name=CHAINE  
         ferm=Fermeture1 ;
    Port2:
    'Port' name=CHAINE '='
    Ouvert3=Ouverture
    ferm2=Fermeture;
    //******************************************
    ProprietyC:     Prop1|Prop2;
    Prop1:name=ID;
    Prop2: 'Properties' 
    ouvertp=Ouverture
        (Pro+=Proprieties)*
     ferm1=Fermeture;
    Proprieties:  name=ID ':' name1=ID '='  chaine=CHAINE ';' ; 
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Connector:  'Connector' name=ID '='
      Ouvert3=Ouverture
     (role+=Role)*
     PropC+=ProprietyC
    ferm3=Fermeture
    ;    
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    Role: Role1|Role2;
    Role1: 'Roles' 
           ouvertR=Ouverture 
           name=CHAINE
           fermR=Fermeture;
    Role2:
    'Role' name=ID '='
         Ouvert4=Ouverture
        ferm4=Fermeture;
    //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     
    //************************************************Family******************
    FAMILY:   'Family' name=ID  '= {'
                 (componenttype+=ComponentType)*
                 (connectortype+=ConnectorType)*
    ;
    //**********************
    ComponentType: 'Component Type'  identifier=CHAINE '= {'
         (portf+=Ports)*
           (propf+=Propertyf)*
    '};' ;
    //*****************ATTENTION à VERIFIER ***************************************
    Ports:  'Ports {' 
    name=CHAINE  '};'; 
    //****************************************************
    Propertyf:  Ide=CHAINE  ;
    //**********************************************************
    ConnectorType: 'Connector Type'  nn=CHAINE  '= {' 
    '};';
    //*********************************************************************
    Ouverture: '{';
    Fermeture: '}';
    Fermeture1: ';';
    //******************************************************************************
    CHAINE : (ID|SL_COMMENT|'-'|'.'|STRING)* ;
    A : (ID|SL_COMMENT|STRING)* ;
    mais lors de l’exécution de cette grammaire j'obtiens les erreurs suivantes:
    1 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering platform uri 'C:\Users\samsung\Desktop\newworkspace\eclipsehelio avec atl\workspace'
    5999 [main] INFO ipse.emf.mwe.utils.DirectoryCleaner - Cleaning C:\Users\samsung\Desktop\newworkspace\eclipsehelio avec atl\workspace\org.xtext.System\..\org.xtext.System\src-gen
    6461 [main] INFO ipse.emf.mwe.utils.DirectoryCleaner - Cleaning C:\Users\samsung\Desktop\newworkspace\eclipsehelio avec atl\workspace\org.xtext.System\..\org.xtext.System.ui\src-gen
    7467 [main] INFO ipse.xtext.generator.LanguageConfig - generating infrastructure for org.xtext.System with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, FormatterFragment, LabelProviderFragment, TransformerFragment, OutlineNodeAdapterFactoryFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment
    warning(200): ../org.xtext.System/src-gen/org/xtext/parser/antlr/internal/InternalSystem.g:1788:1: Decision can match input such as "{RULE_ID..RULE_STRING, '};', '-'..'.'}" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    warning(201): ../org.xtext.System/src-gen/org/xtext/parser/antlr/internal/InternalSystem.g:1788:1: The following alternatives are unreachable: 2

    warning(200): ../org.xtext.System/src-gen/org/xtext/parser/antlr/internal/InternalSystem.g:2100:1: Decision can match input such as "RULE_STRING" using multiple alternatives: 5, 6
    As a result, alternative(s) 6 were disabled for that input
    warning(200): ../org.xtext.System/src-gen/org/xtext/parser/antlr/internal/InternalSystem.g:2100:1: Decision can match input such as "'.'" using multiple alternatives: 4, 6
    As a result, alternative(s) 6 were disabled for that input
    warning(200): ../org.xtext.System/src-gen/org/xtext/parser/antlr/internal/InternalSystem.g:2100:1: Decision can match input such as "RULE_ID" using multiple alternatives: 1, 6
    As a result, alternative(s) 6 were disabled for that input
    warning(200): ../org.xtext.System/src-gen/org/xtext/parser/antlr/internal/InternalSystem.g:2100:1: Decision can match input such as "'-'" using multiple alternatives: 3, 6
    As a result, alternative(s) 6 were disabled for that input
    warning(200): ../org.xtext.System/src-gen/org/xtext/parser/antlr/internal/InternalSystem.g:2100:1: Decision can match input such as "RULE_SL_COMMENT" using multiple alternatives: 2, 6
    As a result, alternative(s) 6 were disabled for that input
    51107 [main] INFO or.validation.JavaValidatorFragment - executing generate for org.eclipse.xtext.generator.validation.JavaValidatorFragment
    warning(200): ../org.xtext.System.ui/src-gen/org/xtext/ui/contentassist/antlr/internal/InternalSystem.g:783:28: Decision can match input such as "RULE_STRING" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    warning(200): ../org.xtext.System.ui/src-gen/org/xtext/ui/contentassist/antlr/internal/InternalSystem.g:783:28: Decision can match input such as "RULE_SL_COMMENT" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    warning(200): ../org.xtext.System.ui/src-gen/org/xtext/ui/contentassist/antlr/internal/InternalSystem.g:783:28: Decision can match input such as "'.'" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    warning(200): ../org.xtext.System.ui/src-gen/org/xtext/ui/contentassist/antlr/internal/InternalSystem.g:783:28: Decision can match input such as "RULE_ID" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    warning(200): ../org.xtext.System.ui/src-gen/org/xtext/ui/contentassist/antlr/internal/InternalSystem.g:783:28: Decision can match input such as "'-'" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    warning(200): ../org.xtext.System.ui/src-gen/org/xtext/ui/contentassist/antlr/internal/InternalSystem.g:3059:40: Decision can match input such as "{RULE_ID..RULE_STRING, '-'..'.', '};'}" using multiple alternatives: 1, 2
    As a result, alternative(s) 2 were disabled for that input
    warning(201): ../org.xtext.System.ui/src-gen/org/xtext/ui/contentassist/antlr/internal/InternalSystem.g:3059:40: The following alternatives are unreachable: 2
    Quelqu'un saurait-il m'indiquer comment résoudre ce problème ?

    Merci d'avance pour votre aide.

  2. #2
    Membre averti
    Homme Profil pro
    Dev
    Inscrit en
    Novembre 2006
    Messages
    112
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Alpes Maritimes (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : Dev

    Informations forums :
    Inscription : Novembre 2006
    Messages : 112
    Points : 350
    Points
    350
    Par défaut
    Bonjour,

    Je pense que ton erreur vient du fait que ta grammaire est ambiguë:

    Regarde ce tutoriel : http://alain-bernard.developpez.com/...aire-xtext/#LV

Discussions similaires

  1. Comment entrer une grammaire sous eclipse ?
    Par lenissart dans le forum Eclipse Java
    Réponses: 1
    Dernier message: 15/04/2006, 16h27
  2. [RMI]comment creer les stubs sous eclipse(lancement de rmic)
    Par juflata dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 22/06/2004, 13h51
  3. [Débutant] SWT sous Eclipse 3.0
    Par bonnefr dans le forum SWT/JFace
    Réponses: 4
    Dernier message: 11/05/2004, 16h01
  4. [CVS] "locker" un fichier sous eclipse
    Par Yan83 dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 10/04/2004, 15h55
  5. [UML]schéma uml sous eclipse
    Par gilles641 dans le forum Eclipse Java
    Réponses: 3
    Dernier message: 26/03/2004, 13h37

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