source: Deliverables/D2.2/8051/src/common/AST.mli @ 619

Last change on this file since 619 was 619, checked in by ayache, 9 years ago

Update of D2.2 from Paris.

File size: 3.4 KB
Line 
1
2(** This file defines some common structures of several languages. *)
3
4type ident = string (* identifiers for variable and function names *)
5
6type immediate = int (* immediate values for assembler constants and offsets *)
7
8
9(* Comparison between integers or floats *)
10
11type cmp = Cmp_eq | Cmp_ne | Cmp_gt | Cmp_ge | Cmp_lt | Cmp_le
12
13(* Constants in high level languages *)
14
15type cst =
16  | Cst_int of int               (* integer constant *)
17  | Cst_float of float           (* float constant *)
18  | Cst_addrsymbol of ident      (* address of a global symbol *)
19  | Cst_stackoffset of immediate (* offset in the stack *)
20
21(* Unary operations *)
22
23type op1 = 
24  | Op_cast8unsigned  (**r 8-bit zero extension  *)
25  | Op_cast8signed    (**r 8-bit sign extension  *)
26  | Op_cast16unsigned (**r 16-bit zero extension  *)
27  | Op_cast16signed   (**r 16-bit sign extension *)
28  | Op_negint         (**r integer opposite *)
29  | Op_notbool        (**r boolean negation  *)
30  | Op_notint         (**r bitwise complement  *)
31  | Op_negf           (**r float opposite *)
32  | Op_absf           (**r float absolute value *)
33  | Op_singleoffloat  (**r float truncation *)
34  | Op_intoffloat     (**r signed integer to float *)
35  | Op_intuoffloat    (**r unsigned integer to float *)
36  | Op_floatofint     (**r float to signed integer *)
37  | Op_floatofintu    (**r float to unsigned integer *)
38  | Op_id             (**r identity *)
39  | Op_ptrofint       (**r int to pointer *)
40  | Op_intofptr       (**r pointer to int *)
41
42(* Binary operations *)
43
44type op2 =
45  | Op_add         (**r integer addition *)
46  | Op_sub         (**r integer subtraction *)
47  | Op_mul         (**r integer multiplication *)
48  | Op_div         (**r integer signed division *)
49  | Op_divu        (**r integer unsigned division *)
50  | Op_mod         (**r integer signed modulus *)
51  | Op_modu        (**r integer unsigned modulus *)
52  | Op_and         (**r bitwise ``and'' *)
53  | Op_or          (**r bitwise ``or'' *)
54  | Op_xor         (**r bitwise ``xor'' *)
55  | Op_shl         (**r left shift *)
56  | Op_shr         (**r right signed shift *)
57  | Op_shru        (**r right unsigned shift *)
58  | Op_addf        (**r float addition *)
59  | Op_subf        (**r float subtraction *)
60  | Op_mulf        (**r float multiplication *)
61  | Op_divf        (**r float division *)
62  | Op_cmp of cmp  (**r integer signed comparison *)
63  | Op_cmpu of cmp (**r integer unsigned comparison *)
64  | Op_cmpf of cmp (**r float comparison *)
65  | Op_addp        (**r addition for a pointer and an integer *)
66  | Op_subp        (**r substraction for a pointer and a integer *)
67  | Op_cmpp of cmp (**r pointer comparaison *)
68
69(* Datas are used to initialize the value of variables *)
70
71type data = 
72  | Data_reserve of int (* only reserve some space *)
73  | Data_int8 of int
74  | Data_int16 of int
75  | Data_int32 of int
76  | Data_float32 of float
77  | Data_float64 of float
78
79type data_size = Byte | HalfWord | Word
80
81(* Types and Signatures *)
82
83type sig_type = Sig_int | Sig_float | Sig_ptr
84
85type type_return = Type_ret of sig_type | Type_void
86
87type signature = { args: sig_type list ; res: type_return }
88
89(* External functions. *)
90
91type external_function = { ef_tag: ident ; ef_sig: signature }
92
93
94(* Traces returned by interpreters: result and cost labels are observed. The
95   result is interpreted as an 8 bits integer for coherence between
96   languages. *)
97
98type trace = IntValue.int8 * CostLabel.t list
Note: See TracBrowser for help on using the repository browser.