GrammaticalFramework / gf-core

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

`gr -cat=S` fails, but `gr UseCl ? ? ?` succeeds #152

Closed inariksit closed 1 year ago

inariksit commented 1 year ago

Here's my grammar: a fragment of the RGL with a custom cat + 3 custom funs on top.

abstract OmitParticles =
  Grammar [ N, CN, NP, UseN, MassNP, V2, S, Cl, Temp, Pol, Tense, Ant
    , UseCl, PPos, PNeg, TTAnt, TPres, TPast, ASimul]
, Lexicon [N, V2, cat_N, dog_N, eat_V2]  ** {
  flags startcat = S ;

  cat
    -- Our custom version of RGL's VP, to allow variants (omitted particles)
    Action ;

  fun
    Topic : NP -> Action -> Cl ;
    AddSubject : NP -> V2 -> Action ;
    AddObject : NP -> V2 -> Action ;
}

The problem already comes in with the abstract syntax.

OmitParticles> gr
no trees found

OmitParticles> gt -cat=S
no trees found

OmitParticles> gr UseCl ? ? ?
UseCl (TTAnt TPres ASimul) PPos (Topic (MassNP (UseN dog_N)) (AddObject (MassNP (UseN cat_N)) eat_V2))

The last random generation succeeds, which tells me that the grammar has all the components. So any ideas why the first two don't?

inariksit commented 1 year ago

Solved by increasing the depth:

OmitParticles> gr
no trees found

OmitParticles> gr -depth=5
UseCl (TTAnt TPast ASimul) PPos (Topic (MassNP (UseN dog_N)) (AddObject (MassNP (UseN dog_N)) eat_V2))