Commit bec30984 authored by Julien Lopez's avatar Julien Lopez
Browse files

[TESTS][LAMBDA][MINOR] Fix GRAMMAR

parent 8f63f467
expr = id
| integer
| INTEGER
| "`true"
| "`false"
| STRING
| CHAR
| abstr
| "let" LIDENT ":" type_id "=" expr "in" expr ":" type_id
| "if" expr "then" expr
......@@ -42,8 +43,11 @@ abstr = "fun" id id ":" type_id params ":" type_id "->" expr
;;
match_value = id ":" type_id
| integer
| INTEGER
| "`true"
| "`false"
| STRING
| CHAR
| match_value "," match_value
| match_value "::" match_value
| "(" match_value ")"
......@@ -80,6 +84,4 @@ complex_type_id = UIDENT (* [A-Z][A-Za-z0-9_]* *)
| complex_type_id "->" complex_type_id
| "[" complex_type_id "]"
| "(" complex_type_id ")"
;;
integer = INTEGER (* [0-9]+ *)
......@@ -70,6 +70,7 @@ let rec g_token n = function
| "UIDENT" -> g_uident 3 ""
| "STRING" -> "\"" ^ g_ident 3 "" ^ "\""
| "INTEGER" -> string_of_int (Random.int 1000)
| "CHAR" -> "'" ^ Char.escaped(Char.chr (Random.int 128)) ^ "'"
| _ ->
let l = Loc.start_line loc in
let cbegin = Loc.start_off loc - Loc.start_bol loc in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment