diff --git a/flap/src/hopix/hopixLexer.mll b/flap/src/hopix/hopixLexer.mll index 106b918..6808086 100644 --- a/flap/src/hopix/hopixLexer.mll +++ b/flap/src/hopix/hopixLexer.mll @@ -28,6 +28,10 @@ let integers = '-'? (digit+ | octa+) let ident = ['a'-'z']['A'-'Z' 'a'-'z' '0'-'9' '_']* +let constr_id = ['A'-'Z']['A'-'Z' 'a'-'z' '0'-'9' '_']* +let type_variable = '\''ident + +let binop = '+' | '-' | '*' | '/' | "&&" | "||"| "=?"| "<=?" |">=?" |"?" rule token = parse (** Layout *) @@ -39,10 +43,29 @@ rule token = parse (** Keywords *) | "let" { LET } + | "type" { TYPE } + | "extern" { EXTERN } + | "fun" { FUN } + | "match" { MATCH } + | "if" { IF } + | "then" { THEN } + | "else" { ELSE } + | "ref" { REF } + | "while" { WHILE } + | "do" { DO } + | "until" { UNTIL } + | "for" { FOR } + | "from" { FROM } + | "to" { TO } + (* Fini ? *) + + (* binar operation : pas sûr pour celui là*) + | binop as b { BINOP (* TODO *) } (** Operators *) | '=' { EQUAL } + (** Values *) | integers as i { INT (Mint.of_string i) } | ident as s { ID s } diff --git a/flap/src/hopix/hopixParser.mly b/flap/src/hopix/hopixParser.mly index 14a8a6e..50e9587 100644 --- a/flap/src/hopix/hopixParser.mly +++ b/flap/src/hopix/hopixParser.mly @@ -5,7 +5,7 @@ %} -%token EOF LET EQUAL +%token EOF LET TYPE EXTERN FUN MATCH IF THEN ELSE REF WHILE DO UNTIL FOR FROM TO BINOP EQUAL %token INT %token ID