packages feed

nanopass 0.0.3.0 → 0.0.3.1

raw patch · 6 files changed

+26/−18 lines, 6 filesdep ~basedep ~containersdep ~megaparsecPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: base, containers, megaparsec, template-haskell, text

API changes (from Hackage documentation)

- Nanopass.Internal.Error: instance GHC.Show.Show Nanopass.Internal.Error.Error
- Nanopass.Internal.Representation: [$sel:baseDefdLang:LanguageInfo] :: LanguageInfo v -> !Maybe (Language 'Valid UpDotName)
- Nanopass.Internal.Representation: [$sel:baseLang:LangMod] :: LangMod -> UpDotName
- Nanopass.Internal.Representation: [$sel:langInfo:Language] :: Language v n -> LanguageInfo v
- Nanopass.Internal.Representation: [$sel:langName:Language] :: Language v n -> Name v n
- Nanopass.Internal.Representation: [$sel:langParams:LanguageInfo] :: LanguageInfo v -> ![Name v LowName]
- Nanopass.Internal.Representation: [$sel:newLang:LangMod] :: LangMod -> UpName
- Nanopass.Internal.Representation: [$sel:newParams:LangMod] :: LangMod -> [Name 'Unvalidated LowName]
- Nanopass.Internal.Representation: [$sel:nontermName:Nonterm] :: Nonterm v -> !Name v UpName
- Nanopass.Internal.Representation: [$sel:nonterms:LanguageInfo] :: LanguageInfo v -> !Map UpName (Nonterm v)
- Nanopass.Internal.Representation: [$sel:nontermsEdit:LangMod] :: LangMod -> [NontermsEdit]
- Nanopass.Internal.Representation: [$sel:originalModProgram:LangMod] :: LangMod -> Maybe String
- Nanopass.Internal.Representation: [$sel:originalProgram:LanguageInfo] :: LanguageInfo v -> !Maybe String
- Nanopass.Internal.Representation: [$sel:prodName:Production] :: Production v -> !Name v UpName
- Nanopass.Internal.Representation: [$sel:productions:Nonterm] :: Nonterm v -> !Map UpName (Production v)
- Nanopass.Internal.Representation: [$sel:sourceLang:Pass] :: Pass -> Name 'Unvalidated UpDotName
- Nanopass.Internal.Representation: [$sel:subterms:Production] :: Production v -> ![TypeDesc v]
- Nanopass.Internal.Representation: [$sel:targetLang:Pass] :: Pass -> Name 'Unvalidated UpDotName
- Nanopass.Internal.Representation: instance GHC.Records.HasField "name" (Nanopass.Internal.Representation.Name v n) n
- Nanopass.Internal.Representation: instance GHC.Show.Show (Nanopass.Internal.Representation.LanguageInfo v)
- Nanopass.Internal.Representation: instance GHC.Show.Show (Nanopass.Internal.Representation.Nonterm v)
- Nanopass.Internal.Representation: instance GHC.Show.Show (Nanopass.Internal.Representation.Production v)
- Nanopass.Internal.Representation: instance GHC.Show.Show (Nanopass.Internal.Representation.TypeDesc v)
- Nanopass.Internal.Representation: instance GHC.Show.Show Nanopass.Internal.Representation.LangMod
- Nanopass.Internal.Representation: instance GHC.Show.Show Nanopass.Internal.Representation.LowName
- Nanopass.Internal.Representation: instance GHC.Show.Show Nanopass.Internal.Representation.NontermsEdit
- Nanopass.Internal.Representation: instance GHC.Show.Show Nanopass.Internal.Representation.Pass
- Nanopass.Internal.Representation: instance GHC.Show.Show Nanopass.Internal.Representation.ProductionsEdit
- Nanopass.Internal.Representation: instance GHC.Show.Show Nanopass.Internal.Representation.UpDotName
- Nanopass.Internal.Representation: instance GHC.Show.Show Nanopass.Internal.Representation.UpName
- Nanopass.Internal.Representation: instance GHC.Show.Show n => GHC.Show.Show (Nanopass.Internal.Representation.Language v n)
- Nanopass.Internal.Representation: instance GHC.Show.Show n => GHC.Show.Show (Nanopass.Internal.Representation.Name v n)
+ Nanopass.Internal.Error: instance GHC.Internal.Show.Show Nanopass.Internal.Error.Error
+ Nanopass.Internal.Representation: [baseDefdLang] :: LanguageInfo (v :: Validate) -> !Maybe (Language 'Valid UpDotName)
+ Nanopass.Internal.Representation: [baseLang] :: LangMod -> UpDotName
+ Nanopass.Internal.Representation: [langInfo] :: Language (v :: Validate) n -> LanguageInfo v
+ Nanopass.Internal.Representation: [langName] :: Language (v :: Validate) n -> Name v n
+ Nanopass.Internal.Representation: [langParams] :: LanguageInfo (v :: Validate) -> ![Name v LowName]
+ Nanopass.Internal.Representation: [newLang] :: LangMod -> UpName
+ Nanopass.Internal.Representation: [newParams] :: LangMod -> [Name 'Unvalidated LowName]
+ Nanopass.Internal.Representation: [nontermName] :: Nonterm (v :: Validate) -> !Name v UpName
+ Nanopass.Internal.Representation: [nontermsEdit] :: LangMod -> [NontermsEdit]
+ Nanopass.Internal.Representation: [nonterms] :: LanguageInfo (v :: Validate) -> !Map UpName (Nonterm v)
+ Nanopass.Internal.Representation: [originalModProgram] :: LangMod -> Maybe String
+ Nanopass.Internal.Representation: [originalProgram] :: LanguageInfo (v :: Validate) -> !Maybe String
+ Nanopass.Internal.Representation: [prodName] :: Production (v :: Validate) -> !Name v UpName
+ Nanopass.Internal.Representation: [productions] :: Nonterm (v :: Validate) -> !Map UpName (Production v)
+ Nanopass.Internal.Representation: [sourceLang] :: Pass -> Name 'Unvalidated UpDotName
+ Nanopass.Internal.Representation: [subterms] :: Production (v :: Validate) -> ![TypeDesc v]
+ Nanopass.Internal.Representation: [targetLang] :: Pass -> Name 'Unvalidated UpDotName
+ Nanopass.Internal.Representation: instance GHC.Internal.Records.HasField "name" (Nanopass.Internal.Representation.Name v n) n
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show (Nanopass.Internal.Representation.LanguageInfo v)
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show (Nanopass.Internal.Representation.Nonterm v)
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show (Nanopass.Internal.Representation.Production v)
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show (Nanopass.Internal.Representation.TypeDesc v)
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show Nanopass.Internal.Representation.LangMod
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show Nanopass.Internal.Representation.LowName
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show Nanopass.Internal.Representation.NontermsEdit
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show Nanopass.Internal.Representation.Pass
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show Nanopass.Internal.Representation.ProductionsEdit
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show Nanopass.Internal.Representation.UpDotName
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show Nanopass.Internal.Representation.UpName
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show n => GHC.Internal.Show.Show (Nanopass.Internal.Representation.Language v n)
+ Nanopass.Internal.Representation: instance GHC.Internal.Show.Show n => GHC.Internal.Show.Show (Nanopass.Internal.Representation.Name v n)
- Nanopass.Internal.Extend: type EditingNonterms = Map UpName (Nonterm 'Valid)
+ Nanopass.Internal.Extend: type EditingNonterms = Map UpName Nonterm 'Valid
- Nanopass.Internal.Parser: type ParseResult = -- | modifications to a language Either (Language 'Unvalidated UpName) LangMod
+ Nanopass.Internal.Parser: type ParseResult = Either Language 'Unvalidated UpName LangMod
- Nanopass.Internal.Representation: CtorType :: Name v UpDotName -> [TypeDesc v] -> TypeDesc v
+ Nanopass.Internal.Representation: CtorType :: Name v UpDotName -> [TypeDesc v] -> TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: Language :: Name v n -> LanguageInfo v -> Language v n
+ Nanopass.Internal.Representation: Language :: Name v n -> LanguageInfo v -> Language (v :: Validate) n
- Nanopass.Internal.Representation: LanguageInfo :: ![Name v LowName] -> !Map UpName (Nonterm v) -> !Maybe String -> !Maybe (Language 'Valid UpDotName) -> LanguageInfo v
+ Nanopass.Internal.Representation: LanguageInfo :: ![Name v LowName] -> !Map UpName (Nonterm v) -> !Maybe String -> !Maybe (Language 'Valid UpDotName) -> LanguageInfo (v :: Validate)
- Nanopass.Internal.Representation: ListType :: TypeDesc v -> TypeDesc v
+ Nanopass.Internal.Representation: ListType :: TypeDesc v -> TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: MaybeType :: TypeDesc v -> TypeDesc v
+ Nanopass.Internal.Representation: MaybeType :: TypeDesc v -> TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: NonEmptyType :: TypeDesc v -> TypeDesc v
+ Nanopass.Internal.Representation: NonEmptyType :: TypeDesc v -> TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: Nonterm :: !Name v UpName -> !Map UpName (Production v) -> Nonterm v
+ Nanopass.Internal.Representation: Nonterm :: !Name v UpName -> !Map UpName (Production v) -> Nonterm (v :: Validate)
- Nanopass.Internal.Representation: Production :: !Name v UpName -> ![TypeDesc v] -> Production v
+ Nanopass.Internal.Representation: Production :: !Name v UpName -> ![TypeDesc v] -> Production (v :: Validate)
- Nanopass.Internal.Representation: RecursiveType :: UpName -> TypeDesc v
+ Nanopass.Internal.Representation: RecursiveType :: UpName -> TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: TupleType :: TypeDesc v -> TypeDesc v -> [TypeDesc v] -> TypeDesc v
+ Nanopass.Internal.Representation: TupleType :: TypeDesc v -> TypeDesc v -> [TypeDesc v] -> TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: UnitType :: TypeDesc v
+ Nanopass.Internal.Representation: UnitType :: TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: VarType :: Name v LowName -> TypeDesc v
+ Nanopass.Internal.Representation: VarType :: Name v LowName -> TypeDesc (v :: Validate)
- Nanopass.Internal.Representation: [SourceName] :: n -> Name 'Unvalidated n
+ Nanopass.Internal.Representation: [SourceName] :: forall n. n -> Name 'Unvalidated n
- Nanopass.Internal.Representation: [ValidName] :: n -> Name -> Name 'Valid n
+ Nanopass.Internal.Representation: [ValidName] :: forall n. n -> Name -> Name 'Valid n
- Nanopass.Internal.Representation: data Language v n
+ Nanopass.Internal.Representation: data Language (v :: Validate) n
- Nanopass.Internal.Representation: data LanguageInfo v
+ Nanopass.Internal.Representation: data LanguageInfo (v :: Validate)
- Nanopass.Internal.Representation: data Name v n
+ Nanopass.Internal.Representation: data Name (v :: Validate) n
- Nanopass.Internal.Representation: data Nonterm v
+ Nanopass.Internal.Representation: data Nonterm (v :: Validate)
- Nanopass.Internal.Representation: data Production v
+ Nanopass.Internal.Representation: data Production (v :: Validate)
- Nanopass.Internal.Representation: data TypeDesc v
+ Nanopass.Internal.Representation: data TypeDesc (v :: Validate)
- Nanopass.Internal.Validate: validateNonterm :: Set UpName -> Map LowName (Name 'Valid LowName) -> Nonterm v -> Either Error (Nonterm 'Valid)
+ Nanopass.Internal.Validate: validateNonterm :: forall (v :: Validate). Set UpName -> Map LowName (Name 'Valid LowName) -> Nonterm v -> Either Error (Nonterm 'Valid)
- Nanopass.Internal.Validate: validateProd :: Set UpName -> Map LowName (Name 'Valid LowName) -> Production v -> Either Error (Production 'Valid)
+ Nanopass.Internal.Validate: validateProd :: forall (v :: Validate). Set UpName -> Map LowName (Name 'Valid LowName) -> Production v -> Either Error (Production 'Valid)
- Nanopass.Internal.Validate: validateType :: Set UpName -> Map LowName (Name 'Valid LowName) -> TypeDesc v -> Either Error (TypeDesc 'Valid)
+ Nanopass.Internal.Validate: validateType :: forall (v :: Validate). Set UpName -> Map LowName (Name 'Valid LowName) -> TypeDesc v -> Either Error (TypeDesc 'Valid)

Files

CHANGELOG.md view
@@ -1,6 +1,11 @@ # Revision history for nanopass -## 0.0.3.0 -- YYYY-mm-dd+## 0.0.3.1 -- 2025-11-12++* updated dependency version bounds; now compiles on ghc 9.2 through 9.12+* I am likely to drop support on ghc versions <9.6++## 0.0.3.0 -- 2024-01-08  * Stop generating records for each production.   (This would create partial fields which were a rich source of bugs for clients.)
nanopass.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: nanopass-version: 0.0.3.0+version: 0.0.3.1 synopsis: Create compilers using small passes and many intermediate representations. description:   Uses Template Haskell to facilitate using a vast number of intermediate representations.@@ -9,8 +9,8 @@      See README.md for more details. category: Language-homepage: https://github.com/edemko/nanopass-bug-reports: https://github.com/edemko/nanopass/issues+homepage: https://github.com/marseillebd/nanopass+bug-reports: https://github.com/marseillebd/nanopass/issues author: Marseille Bounchard maintainer: marseillebd@proton.me copyright: 2022 Marseille Bounchard@@ -21,9 +21,15 @@  source-repository head   type: git-  location: https://github.com/edemko/nanopass+  location: https://github.com/marseillebd/nanopass +common deps+  build-depends:+    , base >=4.11.1 && <4.22+    , template-haskell >=2.18 && <2.24+ library+  import: deps   hs-source-dirs: src   exposed-modules:     Language.Nanopass@@ -38,28 +44,25 @@     Language.Nanopass.QQ     Language.Nanopass.Xlate   build-depends:-    , base >=4.11.1 && <4.19-    , containers >=0.6 && <0.7-    , megaparsec >=9.2 && <9.3+    , containers >=0.6 && <0.9+    , megaparsec >=9.2 && <9.8     , mtl >=2.2 && <2.4     , sexpr-parser >=0.2.2.0 && <0.3-    , template-haskell >=2.18 && <2.21-    , text >=2.0 && <2.1+    , text >=2.0 && <2.2     , pretty-simple >=3.0 && <4.2     , transformers >=0.5.6 && <0.7   default-language: Haskell2010   ghc-options: -Wall -Wpartial-fields -Wunticked-promoted-constructors  executable dumb-nanopass-example+  import: deps   hs-source-dirs: app   main-is: Main.hs   other-modules:     Lang   build-depends:-    , base >=4.11.1 && <4.19     , nanopass     , pretty-simple >=4 && <4.2-    , template-haskell >=2.18 && <2.21     , transformers >=0.5.6 && <0.7   default-language: Haskell2010   ghc-options:
src/Language/Nanopass.hs view
@@ -2,7 +2,7 @@ -- Languages can be created from scratch or by derivation using 'deflang'. -- The tedious parts of a compiler pass (or at least, most passes) can be generated with 'defpass'. ----- More details and examples are given in the [readme](https://github.com/edemko/nanopass/blob/master/README.md).+-- More details and examples are given in the [readme](https://github.com/marseillebd/nanopass/blob/master/README.md). module Language.Nanopass   ( deflang   , defpass
src/Language/Nanopass/LangDef.hs view
@@ -76,7 +76,7 @@   -- define a type with one nullary ctor for every grammatical type   langInfo <- defineLangHeader l   -- define every nonterminal type-  params <- gets langTyvars <&> \tvs -> tvs <&> \tv -> TH.PlainTV tv ()+  params <- gets langTyvars <&> \tvs -> TH.plainTV <$> tvs   nontermTypeDecs <- forM (Map.elems l.langInfo.nonterms) $ \nonterm -> do     M.lift $ TH.addModFinalizer $ TH.putDoc (TH.DeclDoc nonterm.nontermName.th) $       "This type is a non-terminal of the t'" ++ fromUpName l.langName.name ++ "' language."
src/Language/Nanopass/QQ.hs view
@@ -29,7 +29,7 @@ -- The syntax is based on s-expressions. -- -- TODO document the syntax here, or for now you can look in "Nanopass.Internal.Parser"--- More details and examples are given in the [readme](https://github.com/edemko/nanopass/blob/master/README.md).+-- More details and examples are given in the [readme](https://github.com/marseillebd/nanopass/blob/master/README.md). deflang :: QuasiQuoter deflang = QuasiQuoter (bad "expression") (bad "pattern") (bad "type") go   where@@ -84,7 +84,7 @@ -- None of the functions defined by this quasiquoter need to be expoted for Nanopass to function. -- I expect you will not export any of these definitions directly, but instead wrap them into a complete pass, and only export that pass. ----- More details and examples are given in the [readme](https://github.com/edemko/nanopass/blob/master/README.md).+-- More details and examples are given in the [readme](https://github.com/marseillebd/nanopass/blob/master/README.md). -- -- TODO document the syntax here, but for now, see 'parsePass' for a grammar. defpass :: QuasiQuoter
src/Language/Nanopass/Xlate.hs view
@@ -236,7 +236,7 @@     []   where   xlateName = TH.mkName "Xlate"-  tvs = flip TH.PlainTV () <$> xlateParams x ++ [xlateFParam x]+  tvs = TH.plainTV <$> xlateParams x ++ [xlateFParam x]  declareTypeI :: XlateDef -> Q Dec declareTypeI x = do@@ -276,7 +276,7 @@     []   where   xlateName = TH.mkName "XlateI"-  tvs = flip TH.PlainTV () <$> xlateParams x+  tvs = TH.plainTV <$> xlateParams x  declareXlateLifter :: XlateDef -> Q [Dec] declareXlateLifter x = do