From 96c29e2a5e2c97d2c40c46222d4593c366de953e Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Fri, 24 Jul 2020 22:27:13 +0200 Subject: Move Context to cc-ast in preparation for backend parametrisation --- ast/CC/Context.hs | 5 +++++ compcomp.cabal | 4 ++-- main/Main.hs | 2 +- parser/CC/Parser.hs | 1 + typecheck/CC/Typecheck.hs | 1 + utils/CC/Types.hs | 3 --- 6 files changed, 10 insertions(+), 6 deletions(-) create mode 100644 ast/CC/Context.hs diff --git a/ast/CC/Context.hs b/ast/CC/Context.hs new file mode 100644 index 0000000..1f8c673 --- /dev/null +++ b/ast/CC/Context.hs @@ -0,0 +1,5 @@ +module CC.Context where + + +-- | Source metadata for compilation +data Context = Context FilePath diff --git a/compcomp.cabal b/compcomp.cabal index c7fec4e..6635172 100644 --- a/compcomp.cabal +++ b/compcomp.cabal @@ -15,7 +15,7 @@ executable compcomp import: deps hs-source-dirs: main main-is: Main.hs - build-depends: cc-parser, cc-typecheck, cc-utils + build-depends: cc-parser, cc-typecheck, cc-ast, cc-utils library cc-parser import: deps @@ -33,7 +33,7 @@ library cc-ast import: deps hs-source-dirs: ast build-depends: cc-utils - exposed-modules: CC.AST.Source, CC.AST.Typed + exposed-modules: CC.AST.Source, CC.AST.Typed, CC.Context library cc-utils import: deps diff --git a/main/Main.hs b/main/Main.hs index dbac4c4..f5a3d5a 100644 --- a/main/Main.hs +++ b/main/Main.hs @@ -5,8 +5,8 @@ import System.Exit import qualified CC.Parser as Parser import qualified CC.Typecheck as Typecheck +import CC.Context import CC.Pretty -import CC.Types -- Put the passes in a type-level list to be able to run subsequences of diff --git a/parser/CC/Parser.hs b/parser/CC/Parser.hs index f8e482e..76f0b68 100644 --- a/parser/CC/Parser.hs +++ b/parser/CC/Parser.hs @@ -5,6 +5,7 @@ import Text.Parsec hiding (SourcePos, getPosition, token) import qualified Text.Parsec import CC.AST.Source +import CC.Context import CC.Pretty diff --git a/typecheck/CC/Typecheck.hs b/typecheck/CC/Typecheck.hs index 0c926f3..aac7923 100644 --- a/typecheck/CC/Typecheck.hs +++ b/typecheck/CC/Typecheck.hs @@ -12,6 +12,7 @@ import Data.Set (Set) import CC.AST.Source import CC.AST.Typed +import CC.Context import CC.Pretty diff --git a/utils/CC/Types.hs b/utils/CC/Types.hs index b377045..84c62b2 100644 --- a/utils/CC/Types.hs +++ b/utils/CC/Types.hs @@ -6,9 +6,6 @@ import CC.Pretty -- | Names of variables in the program type Name = String --- | Source metadata for compilation -data Context = Context FilePath - -- | Position in a source file; `SourcePos line column`, both zero-based data SourcePos = SourcePos Int Int deriving (Show, Read, Eq, Ord) -- cgit v1.2.3-54-g00ecf