]> matita.cs.unibo.it Git - helm.git/blob - helm/software/matita/contribs/assembly/compiler/linearfe.ma
First attempts at the third phase.
[helm.git] / helm / software / matita / contribs / assembly / compiler / linearfe.ma
1 (**************************************************************************)
2 (*       ___                                                              *)
3 (*      ||M||                                                             *)
4 (*      ||A||       A project by Andrea Asperti                           *)
5 (*      ||T||                                                             *)
6 (*      ||I||       Developers:                                           *)
7 (*      ||T||         The HELM team.                                      *)
8 (*      ||A||         http://helm.cs.unibo.it                             *)
9 (*      \   /                                                             *)
10 (*       \ /        This file is distributed under the terms of the       *)
11 (*        v         GNU General Public License Version 2                  *)
12 (*                                                                        *)
13 (**************************************************************************)
14
15 (* ********************************************************************** *)
16 (*                                                                        *)
17 (* Sviluppato da:                                                         *)
18 (*   Cosimo Oliboni, oliboni@cs.unibo.it                                  *)
19 (*                                                                        *)
20 (* ********************************************************************** *)
21
22 include "compiler/env_to_flatenv.ma".
23 include "compiler/astfe_tree.ma".
24
25 (* ************************************************ *)
26 (* SUCCESSIONE APPIATITA DI ASSEGNAMENTI SU FLATENV *)
27 (* ************************************************ *)
28
29 inductive jumpLabel : Type ≝
30   BEGIN_LABEL: jumpLabel
31 | N_LABEL: nat → jumpLabel
32 | END_LABEL: jumpLabel.
33
34 (* 
35    L1 := goto L1
36    EXPR L1 L2 := if(EXPR) then { goto L1; } else { goto L2; }
37 *)
38 inductive jumpBlock (e:aux_flatEnv_type) : Type ≝
39   JUMPBLOCK_ABS: jumpLabel → jumpBlock e
40 | JUMPBLOCK_COND: astfe_base_expr e → jumpLabel → jumpLabel → jumpBlock e.
41
42 inductive linearfe_stm (e:aux_flatEnv_type) : Type ≝
43   LINEARFE_STM_ASG: ∀t:ast_type.
44                     astfe_var e false t → astfe_expr e t → linearfe_stm e
45 | LINEARFE_STM_INIT: ∀b:bool.∀t:ast_type.
46                      astfe_id e b t → astfe_init e t → linearfe_stm e.
47
48 (* LABEL + [ init/assegnamenti ] + if(EXPR) then { goto LABEL; } else { goto LABEL; } *)
49 inductive linearfe_elem (e:aux_flatEnv_type) : Type ≝
50  LINEARFE_ELEM: jumpLabel → list (linearfe_stm e) → jumpBlock e → linearfe_elem e.
51
52 (* -------------------------- *)
53
54 definition linearfe_prog ≝ λe.list (linearfe_elem e).
55
56 (* -------------------------- *)
57
58 (* programma vuoto *)
59 definition empty_linearfe_prog ≝ nil (linearfe_elem empty_flatEnv).