Skip to content
This repository has been archived by the owner on Jun 17, 2021. It is now read-only.

SauzeauYannis/ProgFonc-Projet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProgFonc-Projet

Table of Contents

Ce projet a été effectué en troisième année du CMI Informatique à l'UFR SFA Université de Poitiers dans le cadre de l'enseignement Programmation fonctionnelle.

Ce projet a été développé en binôme sous Ubuntu avec GNU Emacs et le mode Tuareg.

Sous linux lancer le programme 'exec_project' avec la commande ocamlrun.

Ensuite, le programme attend sur l'entrée standard une suite d'expressiond arithmétiques délimitées par des point-virgules sous la forme notation polonaise inverse.

Un exemple d'utilisation :

$ ocamlrun exec_project
34 56 2 + x * -;
x 3 + 5 7 + + 3 4 * 1 3 + / /;
a b * c * e f + *;
13 2 5 * 1 0 / - +;
^D

Donne le résultat :

Expression numero 1 avant simplification :
34 - ((56 + 2) * x)
Expression numero 1 apres simplification :
34 - 58 * x

Expression numero 2 avant simplification :
((x + 3) + (5 + 7)) / ((3 * 4) / (1 + 3))
Expression numero 2 apres simplification :
(x + 3 + 12) / 3

Expression numero 3 avant simplification :
((a * b) * c) * (e + f)
Expression numero 3 apres simplification :
a * b * c * (e + f)

Expression numero 4 avant simplification :
13 + ((2 * 5) - (1 / 0))
Expression numero 4 apres simplification :
13 + 10 - 1 / 0

Il est aussi possible d'utiliser le programme avec un interpréteur OCaml. Pour cela, il faut utiliser le fichier code.ml qui contient les fonctions ainsi qu'une série de tests pour chacun d'entre elles. Par défaut ce programme doit être interprété avec la version 4.08.1 d'OCaml, cependant 4 autres versions d'OCaml sont disponibles en décommentant la ligne correspondant à votre version d'OCaml.

  • Notion de types
    • Typage des expressions
    • Inférence de type
    • Curryfication
  • Fonctionnelles
    • Filtrage
    • Récursivité
    • Lambda-calcul
  • Stratégies d'évaluations
  • Analyse syntaxique

Nous avons obtenu la note de 10/20.

This project was carried out in the third year of the CMI Informatique at the University of Poitiers as part of the Functional programming teaching programme.

This project was developed in pairs under Ubuntu with GNU Emacs and Tuareg mode.

Under linux run the program 'exec_project'.

Then the program expects a sequence of semicolon-delimited arithmetic expressionsd in the form reverse Polish notation on the standard input.

An example of usage:

$ ocamlrun exec_project
34 56 2 + x * -;
x 3 + 5 7 + + 3 4 * 1 3 + / /;
a b * c * e f + *;
13 2 5 * 1 0 / - +;
^D

Gives the result:

Expression numero 1 avant simplification :
34 - ((56 + 2) * x)
Expression numero 1 apres simplification :
34 - 58 * x

Expression numero 2 avant simplification :
((x + 3) + (5 + 7)) / ((3 * 4) / (1 + 3))
Expression numero 2 apres simplification :
(x + 3 + 12) / 3

Expression numero 3 avant simplification :
((a * b) * c) * (e + f)
Expression numero 3 apres simplification :
a * b * c * (e + f)

Expression numero 4 avant simplification :
13 + ((2 * 5) - (1 / 0))
Expression numero 4 apres simplification :
13 + 10 - 1 / 0

It is also possible to use the program with an OCaml interpreter. To do this, use the code.ml file which contains the functions and a series of tests for each of them. By default this program should be interpreted with OCaml version 4.08.1, however 4 other OCaml versions are available by uncommenting the line corresponding to your OCaml version.

  • Notion of types
    • Typing of expressions
    • Type inference
    • Curryfication
  • Functional
    • Filtering
    • Recursion
    • Lambda calculus
  • Evaluation strategies
  • Syntactic analysis

We obtained a score of 10/20.