language-oberon 0.3.3 → 0.3.3.1
raw patch · 7 files changed
+47/−39 lines, 7 filesdep ~filepathdep ~template-haskellPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: filepath, template-haskell
API changes (from Hackage documentation)
- Language.Oberon.AST: Boolean :: Bool -> Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: Boolean :: Bool -> Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.AST: Builtin :: Text -> Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: Builtin :: Text -> Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.AST: CharCode :: Int -> Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: CharCode :: Int -> Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.AST: Integer :: Integer -> Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: Integer :: Integer -> Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.AST: Nil :: Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: Nil :: Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.AST: Real :: Double -> Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: Real :: Double -> Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.AST: String :: Text -> Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: String :: Text -> Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.AST: data Value λ l (f' :: * -> *) (f :: * -> *)
+ Language.Oberon.AST: data Value λ l (f' :: Type -> Type) (f :: Type -> Type)
- Language.Oberon.Abstract: type Block l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type Block l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type Case l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type Case l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type CaseLabels l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type CaseLabels l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type ConditionalBranch l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type ConditionalBranch l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type Declaration l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l;
+ Language.Oberon.Abstract: type Declaration l = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | d -> l;
- Language.Oberon.Abstract: type Designator l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l;
+ Language.Oberon.Abstract: type Designator l = (d :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | d -> l;
- Language.Oberon.Abstract: type Element l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type Element l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type Expression l = (e :: * -> (* -> *) -> (* -> *) -> *) | e -> l;
+ Language.Oberon.Abstract: type Expression l = (e :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | e -> l;
- Language.Oberon.Abstract: type FPSection l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type FPSection l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type FieldList l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type FieldList l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type FormalParameters l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type FormalParameters l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type Module l = (m :: * -> (* -> *) -> (* -> *) -> *) | m -> l;
+ Language.Oberon.Abstract: type Module l = (m :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | m -> l;
- Language.Oberon.Abstract: type ProcedureHeading l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type ProcedureHeading l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type Statement l = (s :: * -> (* -> *) -> (* -> *) -> *) | s -> l;
+ Language.Oberon.Abstract: type Statement l = (s :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | s -> l;
- Language.Oberon.Abstract: type StatementSequence l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type StatementSequence l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
- Language.Oberon.Abstract: type Type l = (t :: * -> (* -> *) -> (* -> *) -> *) | t -> l;
+ Language.Oberon.Abstract: type Type l = (t :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | t -> l;
- Language.Oberon.Abstract: type Value l = (v :: * -> (* -> *) -> (* -> *) -> *) | v -> l;
+ Language.Oberon.Abstract: type Value l = (v :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | v -> l;
- Language.Oberon.Abstract: type WithAlternative l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l;
+ Language.Oberon.Abstract: type WithAlternative l = (x :: Type -> (Type -> Type) -> (Type -> Type) -> Type) | x -> l;
Files
- ChangeLog.md +5/−0
- language-oberon.cabal +5/−5
- src/Language/Oberon/AST.hs +11/−9
- src/Language/Oberon/Abstract.hs +20/−20
- src/Language/Oberon/ConstantFolder.hs +3/−3
- src/Language/Oberon/Pretty.hs +1/−1
- src/Language/Oberon/Resolver.hs +2/−1
ChangeLog.md view
@@ -1,5 +1,10 @@ # Revision history for language-oberon +## 0.3.3.1 -- 2024-04-27++* Fixed deprecation warnings+* Bumped the upper bound of `filepath`+ ## 0.3.3 -- 2022-09-26 * Using `OverloadedRecordDot` (GHC >= 9.2) instead of field accessors unsupported by GHC 9.6
language-oberon.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: language-oberon-version: 0.3.3+version: 0.3.3.1 synopsis: Parser, pretty-printer, and more for the Oberon programming language description: The library and the executable support both the original Oberon and the Oberon-2 programming language, as described@@ -31,13 +31,13 @@ Language.Oberon.Grammar, Language.Oberon.Pretty, Language.Oberon.Reserializer, Language.Oberon.Resolver, Language.Oberon.TypeChecker build-depends: base >= 4.16 && < 5, base-orphans >= 0.8.2 && < 1.0,- text < 3, containers >= 0.5 && < 1.0, filepath < 1.5, directory < 1.4,+ text < 3, containers >= 0.5 && < 1.0, filepath < 1.6, directory < 1.4, parsers >= 0.12.7 && < 0.13, input-parsers >= 0.2.2 && < 0.4, prettyprinter >= 1.2.1 && < 1.8, either == 5.*, rank2classes >= 1.3 && < 1.6, grammatical-parsers >= 0.7 && < 0.8, deep-transformations == 0.2.*, transformers >= 0.5 && < 0.7,- template-haskell >= 2.11 && < 2.21+ template-haskell >= 2.11 && < 2.22 default-language: Haskell2010 executable parse@@ -45,7 +45,7 @@ -- other-modules: other-extensions: RankNTypes, RecordWildCards, ScopedTypeVariables, FlexibleInstances, DeriveDataTypeable build-depends: base >= 4.12 && < 5, text, either == 5.*, containers >= 0.5 && < 1.0,- repr-tree-syb < 0.2, filepath < 1.5, prettyprinter,+ repr-tree-syb < 0.2, filepath < 1.6, prettyprinter, rank2classes, input-parsers, grammatical-parsers, deep-transformations, language-oberon, optparse-applicative@@ -54,7 +54,7 @@ test-suite examples type: exitcode-stdio-1.0 build-depends: base >= 4.12 && < 5, text, grammatical-parsers,- either == 5.*, directory < 2, filepath < 1.5, prettyprinter,+ either == 5.*, directory < 2, filepath < 1.6, prettyprinter, deep-transformations, tasty >= 0.7, tasty-hunit, language-oberon
src/Language/Oberon/AST.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE DeriveDataTypeable, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, UndecidableInstances,- OverloadedStrings, StandaloneDeriving, TemplateHaskell, TypeFamilies #-}+ OverloadedStrings, StandaloneDeriving, TemplateHaskell, TypeFamilies, TypeOperators #-} {-# OPTIONS_GHC -Wno-simplifiable-class-constraints #-} -- | Concrete data types for Oberon constructs that make up its Abstract Syntax Tree. Every data type from this module@@ -11,6 +11,7 @@ import Control.Applicative (ZipList(ZipList, getZipList)) import Control.Monad (forM, mapM) import Data.Data (Data, Typeable)+import qualified Data.Kind as K (Type) import Data.List.NonEmpty (NonEmpty((:|))) import Data.Text (Text) @@ -298,14 +299,15 @@ deriving instance Show (f (Abstract.Expression l l f' f')) => Show (Element λ l f' f) deriving instance Eq (f (Abstract.Expression l l f' f')) => Eq (Element λ l f' f) -data Value λ l (f' :: * -> *) (f :: * -> *) = Boolean Bool- | Builtin Text- | CharCode Int- | Integer Integer- | Nil- | Real Double- | String Text- deriving (Eq, Show)+data Value λ l (f' :: K.Type -> K.Type) (f :: K.Type -> K.Type)+ = Boolean Bool+ | Builtin Text+ | CharCode Int+ | Integer Integer+ | Nil+ | Real Double+ | String Text+ deriving (Eq, Show) deriving instance (Typeable λ, Typeable l, Typeable f, Typeable f') => Data (Value λ l f' f)
src/Language/Oberon/Abstract.hs view
@@ -15,7 +15,7 @@ ) where import Data.Data (Data)-import Data.Kind (Constraint)+import qualified Data.Kind as K import Data.List.NonEmpty import Data.Text (Text) @@ -35,24 +35,24 @@ -- * @f'@ wraps all descendant nodes, except -- * @f@ wraps all direct children of the node. class Wirthy l where- type Module l = (m :: * -> (* -> *) -> (* -> *) -> *) | m -> l- type Declaration l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l- type Type l = (t :: * -> (* -> *) -> (* -> *) -> *) | t -> l- type Statement l = (s :: * -> (* -> *) -> (* -> *) -> *) | s -> l- type Expression l = (e :: * -> (* -> *) -> (* -> *) -> *) | e -> l- type Designator l = (d :: * -> (* -> *) -> (* -> *) -> *) | d -> l- type Value l = (v :: * -> (* -> *) -> (* -> *) -> *) | v -> l+ type Module l = (m :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | m -> l+ type Declaration l = (d :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | d -> l+ type Type l = (t :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | t -> l+ type Statement l = (s :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | s -> l+ type Expression l = (e :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | e -> l+ type Designator l = (d :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | d -> l+ type Value l = (v :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | v -> l - type FieldList l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type ProcedureHeading l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type FormalParameters l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type FPSection l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type Block l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type StatementSequence l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type Case l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type CaseLabels l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type ConditionalBranch l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l- type Element l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l+ type FieldList l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type ProcedureHeading l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type FormalParameters l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type FPSection l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type Block l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type StatementSequence l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type Case l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type CaseLabels l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type ConditionalBranch l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l+ type Element l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l type Import l = x | x -> l type IdentDef l = x | x -> l@@ -132,7 +132,7 @@ -- | An instance of this type can convert its own constructs to another language that's an instance of 'TargetClass'. class Wirthy l => CoWirthy l where- type TargetClass l :: * -> Constraint+ type TargetClass l :: K.Type -> K.Constraint type TargetClass l = Wirthy coDeclaration :: TargetClass l l' => Declaration l l'' f' f -> Declaration l' l'' f' f coType :: TargetClass l l' => Type l l'' f' f -> Type l' l'' f' f@@ -265,7 +265,7 @@ -- | The finally-tagless associated types and methods relevant to both versions of the Oberon language. class Wirthy l => Oberon l where- type WithAlternative l = (x :: * -> (* -> *) -> (* -> *) -> *) | x -> l+ type WithAlternative l = (x :: K.Type -> (K.Type -> K.Type) -> (K.Type -> K.Type) -> K.Type) | x -> l moduleUnit :: Ident -> [Import l] -> f (Block l' l' f' f') -> Module l l' f' f moduleImport :: Maybe Ident -> Ident -> Import l
src/Language/Oberon/ConstantFolder.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE DataKinds, DeriveGeneric, DuplicateRecordFields, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, OverloadedStrings, RankNTypes, ScopedTypeVariables,- TypeFamilies, UndecidableInstances #-}+ TypeFamilies, TypeOperators, UndecidableInstances #-} -- | The main export of this module is the function 'foldConstants' that folds the constants in Oberon AST using a -- attribute grammar. Other exports are helper functions and attribute types that can be reused for other languages or@@ -23,8 +23,8 @@ import qualified Data.Text as Text import Foreign.Storable (sizeOf) import GHC.Generics (Generic)-import Data.Text.Prettyprint.Doc (layoutCompact, Pretty(pretty))-import Data.Text.Prettyprint.Doc.Render.Text (renderStrict)+import Prettyprinter (layoutCompact, Pretty(pretty))+import Prettyprinter.Render.Text (renderStrict) import qualified Rank2 import qualified Transformation
src/Language/Oberon/Pretty.hs view
@@ -11,7 +11,7 @@ import Data.List (intersperse) import Data.List.NonEmpty (NonEmpty((:|)), toList) import qualified Data.Text as Text-import Data.Text.Prettyprint.Doc+import Prettyprinter import Numeric (showHex) import qualified Language.Oberon.Abstract as Abstract
src/Language/Oberon/Resolver.hs view
@@ -17,6 +17,7 @@ import Data.Either.Validation (Validation(..), validationToEither) import Data.Foldable (toList) import Data.Functor.Compose (Compose(..))+import qualified Data.Kind as K (Type) import Data.List.NonEmpty (NonEmpty(..)) import qualified Data.List.NonEmpty as NonEmpty import qualified Data.List as List@@ -273,7 +274,7 @@ in (\(pos, (r, s'))-> ((pos, r), (scope, s'))) <$> unique InvalidStatement (AmbiguousStatement . (fst <$>)) (resolveStatement <$> statements) -traverseResolveDefault :: Resolution l -> NodeWrap (g (f :: * -> *) f) -> Compose (Resolved l) Placed (g f f)+traverseResolveDefault :: Resolution l -> NodeWrap (g (f :: K.Type -> K.Type) f) -> Compose (Resolved l) Placed (g f f) traverseResolveDefault Resolution{} (Compose ((start, end), Compose (Ambiguous ((ws, x) :| [])))) = Compose (StateT $ \s-> Success (((start, ws, end), x), s)) traverseResolveDefault Resolution{} _ = Compose (StateT $ const $ Failure $ pure AmbiguousParses)