feat: += mg
This commit is contained in:
parent
5e17ce496a
commit
0931e4a1c8
5
src/fichiersRat/src-rat-tam-test/assadd1.rat
Normal file
5
src/fichiersRat/src-rat-tam-test/assadd1.rat
Normal file
|
@ -0,0 +1,5 @@
|
|||
main{
|
||||
int i = 1;
|
||||
i += 2;
|
||||
print i;
|
||||
}
|
8
src/fichiersRat/src-rat-tam-test/assadd2.rat
Normal file
8
src/fichiersRat/src-rat-tam-test/assadd2.rat
Normal file
|
@ -0,0 +1,8 @@
|
|||
main{
|
||||
int i = 3;
|
||||
i += 4;
|
||||
print i;
|
||||
rat r = [4/5];
|
||||
r += [1/8];
|
||||
print r;
|
||||
}
|
6
src/fichiersRat/src-rat-tam-test/assadd3.rat
Normal file
6
src/fichiersRat/src-rat-tam-test/assadd3.rat
Normal file
|
@ -0,0 +1,6 @@
|
|||
main{
|
||||
int i = 1;
|
||||
int j = 2;
|
||||
j += i;
|
||||
print j;
|
||||
}
|
|
@ -77,7 +77,8 @@ i :
|
|||
| IF exp=e li1=bloc ELSE li2=bloc {Conditionnelle (exp,li1,li2)}
|
||||
| WHILE exp=e li=bloc {TantQue (exp,li)}
|
||||
| RETURN exp=e PV {Retour (exp)}
|
||||
| aff=a EQUAL exp=e {Affectation (aff, exp)}
|
||||
| aff=a EQUAL exp=e PV {Affectation (aff, exp)}
|
||||
| aff=a PLUS EQUAL exp=e PV {Affectation (aff, Binaire (Plus, Affectable(aff), exp))}
|
||||
|
||||
dp :
|
||||
| {[]}
|
||||
|
|
|
@ -109,8 +109,6 @@ let rec analyse_type_instruction opt i =
|
|||
let _ = modifier_type_info t info in
|
||||
AstType.Declaration(info, ne)
|
||||
else
|
||||
let _ = print_endline (string_of_type nt) in
|
||||
let _ = print_endline (string_of_type t) in
|
||||
raise (TypeInattendu(nt, t))
|
||||
|
||||
| AstTds.Affectation (aff, e) ->
|
||||
|
|
|
@ -111,4 +111,16 @@ let%expect_test "factrec" =
|
|||
|
||||
let%expect_test "pointeur1" =
|
||||
runtam "../../fichiersRat/src-rat-tam-test/pointeur1.rat";
|
||||
[%expect{| 3 |}]
|
||||
[%expect{| 3 |}]
|
||||
|
||||
let%expect_test "assadd1" =
|
||||
runtam "../../fichiersRat/src-rat-tam-test/assadd1.rat";
|
||||
[%expect{| 3 |}]
|
||||
|
||||
let%expect_test "assadd2" =
|
||||
runtam "../../fichiersRat/src-rat-tam-test/assadd2.rat";
|
||||
[%expect{| 7[37/40] |}]
|
||||
|
||||
let%expect_test "assadd3" =
|
||||
runtam "../../fichiersRat/src-rat-tam-test/assadd3.rat";
|
||||
[%expect{| 3 |}]
|
||||
|
|
Loading…
Reference in a new issue