feat: wsh non en fait

This commit is contained in:
Laurent Fainsin 2021-12-13 17:41:36 +01:00
parent 951a1a441b
commit cef62a7188
4 changed files with 26 additions and 14 deletions

View file

@ -0,0 +1,5 @@
main{
typedef Point = struct { int x int y };
Point p = {1 2}
print (p.x);
}

View file

@ -63,7 +63,6 @@ main : lfi=prog EOF {lfi}
prog : prog :
| ltd=td lf=fonc lfi=prog {let (Programme (_, lf1, li))=lfi in (Programme (ltd, lf::lf1,li))} | ltd=td lf=fonc lfi=prog {let (Programme (_, lf1, li))=lfi in (Programme (ltd, lf::lf1,li))}
(* | lf=fonc lfi=prog {let (Programme ( lf1, li))=lfi in (Programme ( lf::lf1,li))} *)
| ID li=bloc {Programme ([], [], li)} | ID li=bloc {Programme ([], [], li)}
td : td :

View file

@ -101,6 +101,10 @@ and analyse_code_instruction i taille_return taille_args taille_var =
(analyse_code_expression e) ^ (analyse_code_expression e) ^
(analyse_code_affectable a) ^ (analyse_code_affectable a) ^
"STOREI (" ^ string_of_int (getTaille t) ^ ")\n" "STOREI (" ^ string_of_int (getTaille t) ^ ")\n"
| Attribut(aff, info) ->
(analyse_code_affectable a)
(* TODO *)
end end

View file

@ -135,3 +135,7 @@ let%expect_test "typedef1" =
let%expect_test "typedef2" = let%expect_test "typedef2" =
runtam "../../fichiersRat/src-rat-tam-test/typedef2.rat"; runtam "../../fichiersRat/src-rat-tam-test/typedef2.rat";
[%expect{| 2 |}] [%expect{| 2 |}]
let%expect_test "struct1" =
runtam "../../fichiersRat/src-rat-tam-test/struct1.rat";
[%expect{| 1 |}]