Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:H4311/Projet-Grammaire-Langages
- Loading branch information
Showing
53 changed files
with
814 additions
and
144 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,8 @@ namespace dtd { | |
return content->getRegex(); | ||
} | ||
|
||
std::string Element::getName() { | ||
return name; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,28 @@ | ||
CXX = g++ | ||
LD = g++ | ||
EXE = dtd | ||
OBJ = Document.o Declaration.o Attribute.o Element.o ContentSpec.o Children.o ChoiceSeq.o Choice.o Seq.o Name.o | ||
OBJ = Document.o Declaration.o Attribute.o Element.o ContentSpec.o Children.o ChoiceSeq.o Choice.o Seq.o Name.o TestPut.o | ||
CXXFLAGS = -g | ||
LDFLAGS = | ||
|
||
all: dtd | ||
all: dtd analyseDTD | ||
|
||
analyseDTD: *.l *.y makefile | ||
flex -P dtd dtd.l | ||
bison -p dtd --debug --verbose --defines=dtd.tab.h dtd.y | ||
g++ -g -DYYDEBUG=1 -c lex.dtd.c dtd.tab.c | ||
|
||
dtd: $(OBJ) | ||
# $(LD) -o $(EXE) $^ $(LDFLAGS) | ||
$(LD) -o $(EXE) $^ $(LDFLAGS) | ||
rm TestPut.o | ||
|
||
%.o: %.cpp %.hpp | ||
$(CXX) -o $@ -c $< $(CXXFLAGS) | ||
|
||
.PHONY: clean | ||
|
||
clean: | ||
rm -f *.o | ||
-rm -rf *.tab.c lex.*.c *.tab.h *.output *.o | ||
|
||
mrproper: clean | ||
rm -f $(EXE) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include<cstdio> | ||
#include "Content.cpp" | ||
#include "Data.cpp" | ||
#include "EmptyElement.cpp" | ||
#include "Comment.cpp" | ||
#include "Element.cpp" | ||
|
||
#define name(namespace,nom) make_pair(namespace,nom) | ||
#define new_Element(str) new xml::Element(name("",str)) | ||
#define new_EmptyElement(str) new xml::EmptyElement(name("",str)) | ||
#define Att(AttName,AttVal) make_pair(AttName,AttVal) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include "mainTest1.cpp" | ||
#include "mainTest2.cpp" | ||
#include "mainTest3.cpp" | ||
#include "mainTest4.cpp" | ||
|
||
int main(){ | ||
mainTest1(); | ||
mainTest2(); | ||
mainTest3(); | ||
mainTest4(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#include "Test.h" | ||
|
||
string getStrP1(); | ||
string getStrP2(); | ||
|
||
int mainTest1(){ | ||
freopen("test1.xml","w",stdout); | ||
xml::Element* rapport = new_Element("rapport"); | ||
|
||
//Elements de rapport | ||
xml::Element* titreRapport = new_Element("titre"); | ||
xml::Element* auteur = new_Element("auteur"); | ||
xml::Element* resume = new_Element("resume"); | ||
xml::Element* chapitre = new_Element("chapitre"); | ||
|
||
//Elements de titre | ||
xml::Data* titreD = new xml::Data("Réaliser un compilateur"); | ||
titreRapport->getChildren().push_back(titreD); | ||
|
||
//Elements auteur | ||
xml::Element* prenom = new_Element("prenom"); | ||
xml::Data* prenomD = new xml::Data("Nino"); | ||
prenom->getChildren().push_back(prenomD); | ||
|
||
xml::Element* nom = new_Element("nom"); | ||
xml::Data* nomD = new xml::Data("Silverio"); | ||
nom->getChildren().push_back(nomD); | ||
|
||
auteur->getChildren().push_back(prenom); | ||
auteur->getChildren().push_back(nom); | ||
|
||
//Elements resume | ||
xml::Data* resumeD = new xml::Data("Ceci est un extrait du livre \"Réaliser un compilateur: \nles outils Lex et Yacc\" de Nino Silverio"); | ||
resume->getChildren().push_back(resumeD); | ||
|
||
//Elements chapitre | ||
xml::Element* titreChapitre = new_Element("titre"); | ||
xml::Data* titreChapitreD = new xml::Data("Introduction : concepts de base"); | ||
xml::Element* section1 = new_Element("section"); | ||
xml::Element* section2 = new_Element("section"); | ||
xml::Element* titreSection1 = new_Element("titre"); | ||
xml::Data* titreSection1D = new xml::Data("Fonctions et structure d'un compilateur"); | ||
xml::Element* titreSection2 = new_Element("titre"); | ||
xml::Data* titreSection2D = new xml::Data("Réalisation d'un compilateur"); | ||
xml::Element* pSection1 = new_Element("p"); | ||
xml::Element* pSection2 = new_Element("p"); | ||
xml::Data* pSection1D = new xml::Data(getStrP1()); | ||
xml::Data* pSection2D = new xml::Data(getStrP2()); | ||
|
||
pSection1->getChildren().push_back(pSection1D); | ||
titreSection1->getChildren().push_back(titreSection1D); | ||
section1->getChildren().push_back(titreSection1); | ||
section1->getChildren().push_back(pSection1); | ||
|
||
pSection2->getChildren().push_back(pSection2D); | ||
section2->getChildren().push_back(titreSection2); | ||
titreSection2->getChildren().push_back(titreSection2D); | ||
section2->getChildren().push_back(pSection2); | ||
|
||
titreChapitre->getChildren().push_back(titreChapitreD); | ||
chapitre->getChildren().push_back(titreChapitre); | ||
chapitre->getChildren().push_back(section1); | ||
chapitre->getChildren().push_back(section2); | ||
|
||
//getChildren().push_back Rapport | ||
rapport->getChildren().push_back(titreRapport); | ||
rapport->getChildren().push_back(auteur); | ||
rapport->getChildren().push_back(resume); | ||
rapport->getChildren().push_back(chapitre); | ||
|
||
//Document document(doctype); | ||
//document.getChildren().push_back(rapport); | ||
cout<<rapport; | ||
fclose (stdout); | ||
|
||
delete rapport; | ||
return 0; | ||
} | ||
|
||
string getStrP1(){ | ||
return "Tout programme rédigé dans un langage de programmation de haut niveau tel que Pascal ou C ne peut être exécuté par un ordinateur que s'il est traduit en instructions exécutables par l'ordinateur, généralement des instruction en langage machine. L'ordinateur qui doit exécuter le programme ainsi traduit est appelé machine cible."; | ||
} | ||
|
||
string getStrP2(){ | ||
return "Comme l'écriture d'un compilateur est une tâche fort complexe, le programmateur a tout intérêt à travailler en utilisant un langage de programmation de haut niveau."; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
//#include "Test.h" | ||
|
||
string getStrP1(); | ||
string getStrP2(); | ||
|
||
int mainTest2(){ | ||
freopen("test2.xml","w",stdout); | ||
//Doctype doctype("rapport","rap1.dtd"); | ||
xml::Element* rapport = new_Element("rapport"); | ||
|
||
//Elements de rapport | ||
xml::Element* titreRapport = new_Element("titre"); | ||
xml::Element* auteur = new_Element("auteur"); | ||
xml::Element* resume = new_Element("resume"); | ||
xml::Element* chapitre = new_Element("chapitre"); | ||
|
||
//Elements de titre | ||
xml::Data* titreD = new xml::Data("Réaliser un compilateur"); | ||
titreRapport->getChildren().push_back(titreD); | ||
|
||
//Elements auteur | ||
xml::Element* prenom = new_Element("prenom"); | ||
xml::Data* prenomD = new xml::Data("Nino"); | ||
prenom->getChildren().push_back(prenomD); | ||
|
||
xml::Element* nom = new_Element("nom"); | ||
xml::Data* nomD = new xml::Data("Silverio"); | ||
nom->getChildren().push_back(nomD); | ||
|
||
auteur->getChildren().push_back(prenom); | ||
auteur->getChildren().push_back(nom); | ||
|
||
//Elements resume | ||
xml::Data* resumeD = new xml::Data("Ceci est un extrait du livre \"Réaliser un compilateur: \nles outils Lex et Yacc\" de Nino Silverio"); | ||
resume->getChildren().push_back(resumeD); | ||
|
||
//Elements chapitre | ||
xml::Element* section1 = new_Element("section"); | ||
xml::Element* section2 = new_Element("section"); | ||
xml::Element* pSection1 = new_Element("p"); | ||
xml::Element* pSection2 = new_Element("p"); | ||
xml::Data* pSection1D = new xml::Data(getStrP1()); | ||
xml::Data* pSection2D = new xml::Data(getStrP2()); | ||
|
||
pSection1->getChildren().push_back(pSection1D); | ||
//section1->AddAttribute(Att("titre","Fonctions et structure d'un compilateur")); | ||
AttList attPSection1; | ||
attPSection1.push_back(Att("titre","Fonctions et structure d'un compilateur")); | ||
section1->SetAttList(&attPSection1); | ||
section1->getChildren().push_back(pSection1); | ||
|
||
pSection2->getChildren().push_back(pSection2D); | ||
//section2->AddAttribute(Att("titre","Réalisation d'un compilateur")); | ||
AttList attPSection2; | ||
attPSection2.push_back(Att("titre","Réalisation d'un compilateur")); | ||
section2->SetAttList(&attPSection2); | ||
section2->getChildren().push_back(pSection2); | ||
|
||
//chapitre->AddAttribute(Att("titre","Introduction: concepts de base")); | ||
AttList attChapitre; | ||
attChapitre.push_back(Att("titre","Introduction: concepts de base")); | ||
chapitre->SetAttList(&attChapitre); | ||
chapitre->getChildren().push_back(section1); | ||
chapitre->getChildren().push_back(section2); | ||
|
||
//getChildren().push_back Rapport | ||
rapport->getChildren().push_back(titreRapport); | ||
rapport->getChildren().push_back(auteur); | ||
rapport->getChildren().push_back(resume); | ||
rapport->getChildren().push_back(chapitre); | ||
|
||
//xml::Document document(doctype); | ||
//xml::document.getChildren().push_back(rapport); | ||
cout<<rapport; | ||
fclose (stdout); | ||
|
||
delete rapport; | ||
return 0; | ||
} |
Oops, something went wrong.