renommage de bloc en phrase dans le Parser + ReadMe

This commit is contained in:
trochas
2025-02-14 13:16:56 +01:00
parent 2dfcd38fed
commit 4a01a66dba
2 changed files with 13 additions and 18 deletions

View File

@@ -36,11 +36,12 @@ text ::= Text(entity)
entity ::= Entity(String) entity ::= Entity(String)
entity.val=String.self entity.val=String.self
``` ```
|TAD |Nom d'attribut |Type | Polarité |TAD |Nom d'attribut |Type | Polarité
|----------------|-----------------|---------------------|---------| |----------------|-----------------|---------------------|---------|
|phrase | |String |H |phrase | |String |H
|aff | |String |H |aff |s |String |H
|complement |s |String |H |complement |s |String |H
|complement |v |String |H |complement |v |String |H
|complement |c |String |H/S |complement |c |String |H/S
@@ -48,21 +49,15 @@ entity ::= Entity(String)
|TAD |Nom d'attribut |Type | Polarité
|----------------|-----------------|---------------------|---------|
|turtle |val |list(Phrase) |S
|phrase |sujet_p |String |H
|phrase |affs |list(Aff) |S
|aff |sujet_a |String |H
|aff |vebre_a |String |H
|aff |comps |list(comp) |S
|complement |sujet_c |String |H
|complement |verbe_c |String |H
|complement |comp_c |String |H/S
|Entity |val |String |S
##Analyse lexicale et syntaxique ##Analyse lexicale et syntaxique
#Lexer
#Parser
Au début on créer un objet TutrleAST, il génère la structure Ntriple. On transmet le TurtleAST aux "phrase" enfants
#Difficulté :
Nous avons ID qui est un String avec composé de lettres (non accentuées) et de chiffres, commençant obligatoirement par une lettre, et STRING qui peut être n'importe quelle chaîne de caractères (hors "). La grammaire était ambiguë, ce qui provoquait une erreur de compilation de Java

View File

@@ -23,15 +23,15 @@ options {
} }
turtle returns[TurtleAST t]: turtle returns[TurtleAST t]:
{$t = new TurtleAST();} {$t = new TurtleAST();}
bloc[t] EOF phrase[t] EOF
{$t.finishNtriple();} {$t.finishNtriple();}
; ;
bloc [TurtleAST parent]: phrase [TurtleAST parent]:
s=sujet s=sujet
{$parent.addSujet($s.val);} {$parent.addSujet($s.val);}
listvc[parent] P moreBloc[parent] // <entity> list. listvc[parent] P morePhrase[parent] // <entity> list.
; ;
moreBloc [TurtleAST parent] : bloc[parent] morePhrase [TurtleAST parent] : phrase[parent]
| |
; ;
sujet returns[String val]: sujet returns[String val]: