Make <=, >= and <> work

This commit is contained in:
Benjamin Loison 2022-12-10 19:24:34 +01:00
parent a44c9288f5
commit ac1eea42e9
2 changed files with 4 additions and 7 deletions

View File

@ -125,8 +125,7 @@ let pp_expression =
begin
let s = match cop with
| COp_eq -> " == "
| COp_neq -> ""
(* TODO: check <= and >= *)
| COp_neq -> " != "
| COp_le -> " <= " | COp_lt -> " < "
| COp_ge -> " >= " | COp_gt -> " > " in
Format.fprintf fmt "%s%a%s%a" prefix

View File

@ -16,15 +16,10 @@
("int", TYP(Ast.TInt));
("real", TYP(Ast.TReal));
("bool", TYP(Ast.TBool));
("<=", CMP_le);
(">=", CMP_ge);
("not", MO_not);
("mod", BO_mod);
("&&", BO_and);
("and", BO_and);
("||", BO_or);
("or", BO_or);
("<>", CMP_neq);
("if", IF);
("then", THEN);
("else", ELSE);
@ -56,7 +51,10 @@ rule token = parse
| ';' { SEMICOL }
| ':' { COLON }
| '<' { CMP_lt }
| "<=" { CMP_le }
| '>' { CMP_gt }
| ">=" { CMP_ge }
| "<>" { CMP_neq }
| '+' { PLUS }
| '-' { MINUS }
| '*' { BO_mul }