GrammaticalFramework/gf-core

Parsing variable identifiers into higher-order AST

Closed this issue · 4 comments

Reporting this issue from 2016, which hasn't been solved. I get the same error on GF 3.10.4.

The following example based on section 6.9 of the GF book is giving me some trouble.

abstract Binding = {
cat Identifier; Prop;
fun
All : (Identifier -> Prop) -> Prop;
Eq : Identifier -> Identifier -> Prop;
AnIdentifier : Identifier;
}
concrete BindingStr of Binding = {
lincat Prop, Identifier = {s:Str};
lin All b = { s = "(" ++ "All" ++ b.$0 ++ ")" ++ b.s} ;
lin Eq a b = {s = "("++a.s ++ "=" ++ b.s ++ ")" } ;
lin AnIdentifier = {s = "defaultId"};
}

Linearizing works:

linearize (All (\v1 -> Eq v1 v1))

( All v1 ) ( v1 = v1 )

However, parsing fails:

linearize (All (\v1 -> Eq v1 v1)) | parse -cat=Prop
The parsing is successful but the type checking failed with error(s):
Function 'lindef Identifier' is not in scope

Also tried adding "lindef Identifier = \s -> {s = s};", but this still gives the same error.

Also, the first example given in gf-contrib/typetheory/README fails in a similary way.

I am running GF version 3.8. Built on linux/x86_64 with ghc-7.8, flags: interrupt server c-runtime.

Regards,
Bjørnar Luteberget.

(If this is deemed as wontfix, I can volunteer to update the documentation on our website to reflect this.)

Cool, thanks! I understand why a bug like this is left unnoticed :-P My main motivation in bringing it up was just to keep our webpage/tutorial up to date, so that when people are trying out the tutorial, they will actually find it working. (That's why my alternative suggestion was to change the tutorial.) But great that it is fixed now!