[parser] new parser, no more pp (for now)
This commit is contained in:
@@ -13,24 +13,23 @@
|
||||
("node", NODE);
|
||||
("returns", RETURNS);
|
||||
("var", VAR);
|
||||
("int", INT);
|
||||
("bool", BOOL);
|
||||
("<=", BO_le);
|
||||
(">=", BO_ge);
|
||||
("int", TYP(Ast.TInt));
|
||||
("bool", TYP(Ast.TBool));
|
||||
("<=", CMP_le);
|
||||
(">=", CMP_ge);
|
||||
("not", MO_not);
|
||||
("mod", BO_mod);
|
||||
("&&", BO_and);
|
||||
("and", BO_and);
|
||||
("||", BO_or);
|
||||
("or", BO_or);
|
||||
("<>", BO_neq);
|
||||
("<>", CMP_neq);
|
||||
("if", IF);
|
||||
("then", THEN);
|
||||
("else", ELSE);
|
||||
("≤", BO_le);
|
||||
("≥", BO_ge );
|
||||
("¬", MO_not);
|
||||
("pre", PRE);
|
||||
("merge", TO_merge);
|
||||
("when", WHEN);
|
||||
("pre", MO_pre);
|
||||
("true", CONST_BOOL(true));
|
||||
("false", CONST_BOOL(false));
|
||||
];
|
||||
@@ -46,20 +45,21 @@ rule token = parse
|
||||
['\n' ' ' '\t'] { token lexbuf } (* skip blanks and newlines *)
|
||||
| ident { id_or_keywork (lexeme lexbuf) }
|
||||
| digit+ { CONST_INT(int_of_string (lexeme lexbuf)) }
|
||||
| digit*'.'digit+ { CONST_REAL(float_of_string (lexeme lexbuf)) }
|
||||
| ',' { COMMA }
|
||||
| '=' { EQUAL }
|
||||
| '(' { LPAREN }
|
||||
| ')' { RPAREN }
|
||||
| ';' { SEMICOL }
|
||||
| ':' { COLON }
|
||||
| '<' { BO_lt }
|
||||
| '>' { BO_gt }
|
||||
| '<' { CMP_lt }
|
||||
| '>' { CMP_gt }
|
||||
| '+' { PLUS }
|
||||
| '-' { MINUS }
|
||||
| '*' { BO_mul }
|
||||
| '/' { BO_div }
|
||||
| '%' { BO_mod }
|
||||
| "->" { ARROW }
|
||||
| "->" { BO_arrow }
|
||||
| eof { EOF }
|
||||
| _ { raise (Lexing_error (Format.sprintf "Erruer à la vue de %s" (lexeme lexbuf)))}
|
||||
|
||||
|
Reference in New Issue
Block a user