From 8faeb458327a771aab719dc2d368cffc900d503a Mon Sep 17 00:00:00 2001 From: tuvu Date: Wed, 12 Feb 2025 16:27:04 +0100 Subject: [PATCH] update ads to ntriples --- ASD.txt | 4 ++-- README.md | 13 +++++++++++- src/main/antlr/TurtleLexer.g | 40 +++++++++++++++++++++++++++++++++--- src/main/java/TP1/Main.java | 32 ----------------------------- 4 files changed, 51 insertions(+), 38 deletions(-) diff --git a/ASD.txt b/ASD.txt index b44694c..31a788f 100644 --- a/ASD.txt +++ b/ASD.txt @@ -17,8 +17,8 @@ complement ::= Complement(String) turtle ::= Turtle(phrase*) -phrase ::= Phrase(entity, aff*) -aff ::= Aff(entity, complement*) +phrase ::= Phrase(String, aff*) +aff ::= Aff(String, complement*) complement ::= Complement(Entity) | Complement_Text(String) entity ::= Entity(String) diff --git a/README.md b/README.md index e894fa4..4f9f553 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,18 @@ complement ent String H entity val String S - +|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 ``` diff --git a/src/main/antlr/TurtleLexer.g b/src/main/antlr/TurtleLexer.g index cb08d22..017c832 100644 --- a/src/main/antlr/TurtleLexer.g +++ b/src/main/antlr/TurtleLexer.g @@ -8,10 +8,44 @@ options { package TP1; } -@members { - +@members { } - +LC : '<' + ; +RC : '>' + ; +P: '.' + ; +V: ',' + ; +SEMI: ';' + ; +G: '"' + ; +prog : bloc EOF + ; +bloc : sujet listvc P + ; +sujet : LC entity RC + ; +listvc : LC vc RC more + ; +more : SEMI listvc + | + ; +vc : LC verbe RC listc + ; +listc : LC comp RC morec + ; +morec : V comp + | + ; +entity : ID + ; +verbe : ID + ; +comp : ID + ; // Whitespaces are ignored. fragment WS: (' ' | '\n' | '\t' | '\r' | '\u000C'); diff --git a/src/main/java/TP1/Main.java b/src/main/java/TP1/Main.java index 26575e9..f68d23c 100644 --- a/src/main/java/TP1/Main.java +++ b/src/main/java/TP1/Main.java @@ -15,38 +15,6 @@ import TP1.ASD_Turtle.*; public class Main { /** * Buils example AST and illustrates the translator. - * - - LC : '<' - ; - RC : '>' - ; - P: '.' - ; - V: ',' - ; - SEMI: ';' - ; - G: '"' - ; - prog : bloc EOF - ; - bloc : sujet listvc P - ; - sujet : LC entity RC - ; - listvc : LC vc RC more - ; - more : SEMI listvc - | - ; - vc : LC verbe RC listc - ; - listc : LC comp RC morec - ; - morec : V comp - | - ; */ public static void manualAST() { //Ridoux , ;