-- | The `Zero` fragment has no features and no primops.-- It it provides the first order calculus, and is good for debugging.moduleDDC.Build.Language.Zero(language,bundle,fragment,Name,Error)whereimportDDC.Core.SimplifierimportDDC.Build.Language.BaseimportDDC.Core.Fragmenthiding(Error)importDDC.Core.Transform.NamifyimportDDC.Base.PrettyimportDDC.Data.TokenimportDDC.Type.ExpimportData.TypeableimportDDC.Type.Env(Env)importDDC.Core.LexerasCoreimportqualifiedDDC.Type.EnvasEnvimportqualifiedData.MapasMapimportControl.Monad.State.StrictimportControl.DeepSeq-- | Language definitition for Disciple Core Zero.language::Languagelanguage=Languagebundle-- | Language bundle for Disciple Core Zerobundle::BundleIntNameErrorbundle=Bundle{bundleFragment=fragment,bundleModules=Map.empty,bundleStateInit=0::Int,bundleSimplifier=TransId,bundleMakeNamifierT=makeNamifierfreshT,bundleMakeNamifierX=makeNamifierfreshX,bundleRewriteRules=Map.empty}-- | Fragment definition for Disciple Core Eval.fragment::FragmentNameErrorfragment=Fragment{fragmentProfile=zeroProfile,fragmentExtension="dcz",fragmentReadName=\x->Just(Namex),fragmentLexModule=lexModuleZero,fragmentLexExp=lexExpZero,fragmentCheckModule=constNothing,fragmentCheckExp=constNothing}dataErrora=ErrorderivingShowinstancePretty(Errora)wherepprError=text(showError)-- Wrap the names we use for the zero fragment, -- so they get pretty printed properly.dataName=NameStringderiving(Eq,Ord,Show,Typeable)instanceNFDataNamewherernf(Namestr)=rnfstrinstancePrettyNamewhereppr(Namestr)=textstr-- | Lex a string to tokens, using primitive names.---- The first argument gives the starting source line number.lexModuleZero::String->Int->String->[Token(TokName)]lexModuleZerosrcNamesrcLinestr=maprn$Core.lexModuleWithOffsidesrcNamesrcLinestrwherern(Tokentsp)=caserenameTok(Just.Name)tofJustt'->Tokent'spNothing->Token(KJunk"lexical error")sp-- | Lex a string to tokens, using primitive names.---- The first argument gives the starting source line number.lexExpZero::String->Int->String->[Token(TokName)]lexExpZerosrcNamesrcLinestr=maprn$Core.lexExpsrcNamesrcLinestrwherern(Tokentsp)=caserenameTok(Just.Name)tofJustt'->Tokent'spNothing->Token(KJunk"lexical error")sp-- | Create a new type variable name that is not in the given environment.freshT::EnvName->BindName->StateIntNamefreshTenvbb=doi<-getput(i+1)letn=Name$"t"++showicaseEnv.lookupNamenenvofNothing->returnn_->freshTenvbb-- | Create a new value variable name that is not in the given environment.freshX::EnvName->BindName->StateIntNamefreshXenvbb=doi<-getput(i+1)letn=Name$"x"++showicaseEnv.lookupNamenenvofNothing->returnn_->freshXenvbb