GithubHelp home page GithubHelp logo

kiitoss / compilateur Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.74 MB

Ce projet a pour but la création d'un compilateur et d'une machine virtuelle pour le langage CPYRR, un langage procédural à structure de blocs.

Lex 3.37% Makefile 3.35% Yacc 19.42% C 73.86%

compilateur's Introduction

Compilateur

Sections

  1. Explication du projet
  2. Commandes
  3. Exemples d'exécution
  4. Presentation

Explication du projet

Ce projet a pour but la création d'un compilateur et d'une machine virtuelle pour le langage CPYRR, un langage procédural à structure de blocs.


Une première phase de compilation va permettre la construction de tables et d'un arbre binaire tout en effectuant une analyse lexicale, synthaxique et sémantique.

Ces tables et cet arbre seront ensuite stockés dans un fichier : c'est le texte intermédiaire


L'interpreteur est chargé d'executer le programme après récupération des tables et de l'arbre dans le texte intermédiaire. L'exécution se fait par un parcours de l'arbre, chaque noeud parcouru est analysé et une pile d'exécution est générée pour stocker les données.


Commandes

Création de l'executable

make

Compilation + interprétation

./compilateur.exe -r fichier

Compilation (affichagee de l'aide)

./compilateur.exe -h

Interprétation (affichagee de l'aide)

./interpreteur.exe -h

Exemples d'exécution

r-5.txt

fichier source

PROG
    var a : float;
    var b : float;
DEBUT
    a := 1;
    b := 1,2;
    ecrit ("Le resultat de \f + \f caste en entier est \d", a, b, a + b);
FIN

commande d'exécution

./compilateur.exe -r ./exemples/representatifs/r-5.txt

resultat

Debut de la compilation
Compilation terminee
Debut de l'interpretation

Le resultat de 1.000000 + 1.200000 caste en entier est 2

Interpretation terminee

r-14.txt

fichier source

PROG
var entier : int;
    fonction demande_entier() retourne int
    var a : int;
    DEBUT
        ecrit("Saisissez un entier: ");
        lire(a);
        retourne a;
    FIN;
DEBUT
    entier := demande_entier();
    ecrit("Affichage de l'entier: \d", entier);
FIN

commande d'exécution

./compilateur.exe -r ./exemples/representatifs/r-14.txt

resultat

Debut de la compilation
Compilation terminee
Debut de l'interpretation

Saisissez un entier: 4
Affichage de l'entier: 4

Interpretation terminee

Presentation

Votre navigateur ne supporte pas la lecture de PDFs: Télécharger la présentation.

compilateur's People

Contributors

kiitoss avatar zestones avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.