From eac79b709135f35f5ff47cf0c3bb61d8f1b3676e Mon Sep 17 00:00:00 2001 From: Kathy Gray Date: Fri, 26 Jul 2013 15:27:55 +0100 Subject: A parser without any conflicts. The ott files have been adjusted to reflect some syntax changes in typquant specifications, and the type annotations are not optional for function definitions; we need additional syntax to help the parser if we want to allow functions without type annotations. --- language/l2.ott | 11 ++++++----- language/l2_parse.ott | 11 +++++++---- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'language') diff --git a/language/l2.ott b/language/l2.ott index 9df7c682..deca115e 100644 --- a/language/l2.ott +++ b/language/l2.ott @@ -436,16 +436,17 @@ kinded_id :: 'KOpt_' ::= {{ aux _ l }} | id :: :: none {{ com identifier }} | kind id :: :: kind {{ com kind-annotated variable }} - | ( kinded_id ) :: S :: paren {{ icho [[kinded_id]] }} + +quant_item :: 'QI_' ::= + {{ com Either a kinded identifier or a nexp constraint for a typquant }} + | kinded_id :: :: id {{ com An optionally kinded identifier }} + | nexp_constraint :: :: const {{ com A constraint for this type }} typquant :: 'TypQ_' ::= {{ com type quantifiers and constraints}} {{ aux _ annot }} {{ auxparam 'a }} - | forall kinded_id1 ... kinded_idn . nexp_constraint1 , ... , nexp_constrainti . :: :: tq {{ texlong }} - + | forall quant_item1 , ... , quant_itemn . :: :: tq {{ texlong }} % WHY ARE CONSTRAINTS HERE AND NOT IN THE KIND LANGUAGE - - | forall kinded_id1 ... kinded_idn . :: :: no_constraint {{ com sugar, omitting constraints}} | :: :: no_forall {{ com sugar, omitting quantifier and constraints }} typschm :: 'TypSchm_' ::= diff --git a/language/l2_parse.ott b/language/l2_parse.ott index 74c154ba..18d68a54 100644 --- a/language/l2_parse.ott +++ b/language/l2_parse.ott @@ -405,17 +405,20 @@ kinded_id :: 'KOpt_' ::= {{ aux _ l }} | id :: :: none {{ com identifier }} | kind id :: :: kind {{ com kind-annotated variable }} - | ( kinded_id ) :: S :: paren {{ icho [[kinded_id]] }} + +quant_item :: 'QI_' ::= + {{ com Either a kinded identifier or a nexp constraint for a typquant }} + {{ aux _ l }} + | kinded_id :: :: id {{ com An optionally kinded identifier }} + | nexp_constraint :: :: const {{ com A constraint for this type }} typquant :: 'TypQ_' ::= {{ com type quantifiers and constraints}} % {{ aux _ annot }} {{ auxparam 'a }} {{ aux _ l }} - | forall kinded_id1 ... kinded_idn . nexp_constraint1 , ... , nexp_constrainti . :: :: tq {{ texlong }} + | forall quant_item1 , ... , quant_itemn . :: :: tq {{ texlong }} % WHY ARE CONSTRAINTS HERE AND NOT IN THE KIND LANGUAGE - - | forall kinded_id1 ... kinded_idn . :: :: no_constraint {{ com sugar, omitting constraints}} | :: :: no_forall {{ com sugar, omitting quantifier and constraints }} typschm :: 'TypSchm_' ::= -- cgit v1.2.3