diff --git a/demos/system-F-type/parser.mly b/demos/system-F-type/parser.mly index cc780dea3932cd47fdb56c82feef22fc887d490c..c6eb4daf2db4d94b5c30a67fe987b187011275d5 100644 --- a/demos/system-F-type/parser.mly +++ b/demos/system-F-type/parser.mly @@ -33,7 +33,8 @@ (* A top level is a term. See that only terms are accepted as top level expression. Type term like type application is not allowed. - Parenthesis is not mandatory for the top level expressions. + Parentheses are not mandatory for the top level expressions. + A top level expression must be ended with ;; to evaluate it (as in OCaml). *) top_level: | t = term ; SEMICOLON ; SEMICOLON { t } @@ -51,6 +52,9 @@ term: t = term { F.TeAbs(bv, typevar, t) } +(* Build an abstraction. For ease of reading when the variable type is long, + parentheses are added around the variable and the type. +*) | ABSTRACTION ; LPARENT ; bv = VAR ; @@ -81,14 +85,11 @@ term: t = term { F.TeProj(i, t) } -(* Build a term application. It must be surround by parenthesis: it avoids - conflicts between (id [A] x), (id [B] y) and id [A] (x, id [B] y) - By a previous rule, we can add as many parenthesis as we want. +(* Build a term application. No parentheses are mandatory. *) -| +| t1 = term ; t2 = term { - F.TeApp(t1, t2) } (* Build a Let definition *) @@ -108,7 +109,7 @@ term: F.TeTyAbs(id, t) } (* Surround term with nested parentheses. Allow to add an infinite number of - parenthesis without modifying the meaning + parentheses. *) | LPARENT ; t = term ;