TP-automates/BE_2021_2022/ascendant/Parser.mly
2023-06-21 19:58:18 +02:00

89 lines
3.8 KiB
OCaml

%{
(* Partie recopiee dans le fichier CaML genere. *)
(* Ouverture de modules exploites dans les actions *)
(* Declarations de types, de constantes, de fonctions, d'exceptions exploites dans les actions *)
%}
/* Declaration des unites lexicales et de leur type si une valeur particuliere leur est associee */
%token UL_MODEL
%token UL_ACCOUV UL_ACCFER
%token UL_SYSTEM
%token UL_BLOCK
%token UL_FLOW UL_FROM UL_TO
%token UL_IN UL_OUT
%token UL_INT UL_FLOAT UL_BOOLEAN
%token UL_PAROUV UL_PARFER
%token UL_CROOUV UL_CROFER
%token UL_PTV UL_VIRG UL_PT2 UL_PT
/* Defini le type des donnees associees a l'unite lexicale */
%token <string> UL_IDENT
%token <string> UL_PORT
%token <int> UL_ENTIER
/* Unite lexicale particuliere qui represente la fin du fichier */
%token UL_FIN
/* Type renvoye pour le nom terminal document */
%type <unit> modele
/* Le non terminal document est l'axiome */
%start modele
%% /* Regles de productions */
modele : UL_MODEL UL_IDENT UL_ACCOUV loop_element UL_ACCFER UL_FIN { (print_endline "modele : UL_MODEL IDENT { loop_element } UL_FIN ") }
element : bloc { (print_endline "element : bloc") }
| systeme { (print_endline "element : systeme") }
| flot { (print_endline "element : flot") }
loop_element : /* Lambda */ { (print_endline "loop_element : /* Lambda */") }
| element loop_element { (print_endline "loop_element : element loop_element") }
bloc : UL_BLOCK UL_IDENT parametres UL_PTV { (print_endline "bloc : UL_BLOCK UL_IDENT parametres UL_PTV") }
systeme : UL_SYSTEM UL_IDENT parametres UL_ACCOUV loop_element UL_ACCFER { (print_endline "systeme : UL_SYSTEM UL_IDENT parametres UL_ACCOUV loop_element UL_ACCFER") }
parametres : UL_PAROUV port loop_port UL_PARFER { (print_endline "parametres : UL_PAROUV port loop_port UL_PARFER") }
loop_port : /* Lambda */ { (print_endline "loop_port : /* Lambda */") }
| UL_VIRG port loop_port { (print_endline "loop_port : UL_VIRG port loop_port") }
port : UL_PORT UL_PT2 in_or_out type_ { (print_endline "port : UL_PORT UL_PT2 in_or_out type_") }
in_or_out : UL_IN { (print_endline "in_or_out : UL_IN") }
| UL_OUT { (print_endline "in_or_out : UL_OUT") }
type_ : select_type option_entiers { (print_endline "type_ : select_type option_entiers") }
select_type : UL_INT { (print_endline "select_type : UL_INT") }
| UL_FLOAT { (print_endline "select_type : UL_FLOAT") }
| UL_BOOLEAN { (print_endline "select_type : UL_BOOLEAN") }
option_entiers : /* Lambda */ { (print_endline "option_entiers : /* Lambda */") }
| UL_CROOUV UL_ENTIER loop_entier UL_CROFER { (print_endline "option_entiers : UL_CROOUV UL_ENTIER loop_entier UL_CROFER") }
loop_entier : /* Lambda */ { (print_endline "loop_entier : /* Lambda */") }
| UL_VIRG UL_ENTIER loop_entier { (print_endline "loop_entier : UL_VIRG UL_ENTIER loop_entier") }
flot : UL_FLOW UL_PORT UL_FROM option_ident UL_PORT UL_TO option_loop_ident_port UL_PTV { (print_endline "flot : UL_FLOW UL_PORT UL_FROM option_ident UL_PORT UL_TO option_loop_ident_port UL_PTV") }
option_ident : /* Lambda */ { (print_endline "option_ident : /* Lambda */") }
| UL_IDENT UL_PT { (print_endline "option_ident : UL_IDENT UL_PT") }
ident_port : option_ident UL_PORT { (print_endline "ident_port : option_ident UL_PORT") }
loop_ident_port : /* Lambda */ { (print_endline "loop_ident_port : /* Lambda */") }
| UL_VIRG ident_port loop_ident_port { (print_endline "loop_ident_port : UL_IDENT UL_PT") }
option_loop_ident_port : /* Lambda */ { (print_endline "option_loop_ident_port : /* Lambda */") }
| ident_port loop_ident_port { (print_endline "option_loop_ident_port : ident_port loop_ident_port") }
%%