GrammaticalFramework / gf-core

Grammatical Framework core: compiler, shell & runtimes
https://www.grammaticalframework.org
Other
131 stars 35 forks source link

`cc` doesn't work for many RGL languages #56

Open odanoburu opened 4 years ago

odanoburu commented 4 years ago

reproducing the issue reported by @heatherleaf on https://groups.google.com/forum/#!topic/gf-dev/zYJn2dpaKeQ:

I've stumbled upon a problem with the cc command, for some RGL languages (e.g., English, German, all Scandinavian and Romance languages). Apparently it doesn't recognise when we hide functions from imports:

> i -retain -no-pmcfg english/LangEng.gf
> cc UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN house_N)) (UseComp (CompAP (PositA big_A)))))
Warning: atomic term PPos
         conflict TenseX.PPos, GrammarEng.PPos
         given MarkHTMLX, CommonX, CatEng, MarkupEng, CommonX, CatEng,
               DocumentationEng, CommonX, CatEng, ConstructionEng, CommonX,
               CatEng, LexiconEng, CommonX, TenseX, CommonX, CatEng, IdiomEng,
               CommonX, CatEng, StructuralEng, CommonX, TextX, CommonX, CatEng,
               PhraseEng, CommonX, CatEng, ConjunctionEng, CommonX, CatEng,
               RelativeEng, CommonX, CatEng, QuestionEng, CommonX, CatEng,
               SentenceEng, CommonX, CatEng, NumeralEng, CommonX, CatEng,
               AdverbEng, CommonX, CatEng, AdjectiveEng, CommonX, CatEng, VerbEng,
               CommonX, CatEng, NounEng, GrammarEng, LangEng
missing record fields: p type of PPos
expected: {s : Str; p : ResEng.CPolarity}
inferred: {s : Str; lock_Pol : {}; p : ParamX.Polarity}

TenseX is imported in english/GrammarEng.gf, but PPos is hidden from the import. It seems like cc doesn't recognise that:

concrete GrammarEng of Grammar =
    (...),
    TenseX - [Pol,PPos,PNeg,SC,CAdv]
    ** open ResEng, Prelude in {
(...)
lin
  PPos = {s = [] ; p = CPos} ;
  PNeg = {s = [] ; p = CNeg True} ; -- contracted: don't
}

The same problem occurs for many languages, but not all. E.g., Finnish, Dutch, Afrikaans, Latin all work fine:

> i -retain -no-pmcfg finnish/LangFin.gf
> cc UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN house_N)) (UseComp (CompAP (PositA big_A)))))
{s = "talo" ++ "on" ++ "suuri"; lock_S = <>; lock_Utt = <>}

personally, I'd love to see this fixed too because some grammars take very long to compile (PGF) or link (GFO), so we can't iterate as fast, and testing is slow.

inariksit commented 3 years ago

The immediate problem, when running cc for RGL languages, is fixed via #57. However, the underlying problem has something to do with recognising excluded functions, and is still an issue for non-RGL grammas.