diff options
author | Tom Smeding <tom.smeding@gmail.com> | 2020-07-24 22:27:13 +0200 |
---|---|---|
committer | Tom Smeding <tom.smeding@gmail.com> | 2020-07-24 22:32:20 +0200 |
commit | 96c29e2a5e2c97d2c40c46222d4593c366de953e (patch) | |
tree | 7b8cef6e8cfaeedd7ff4e712cf9f878f849781b3 | |
parent | f7c3b21c0a10b11730bdce64e7e895bd1eb65fd0 (diff) |
Move Context to cc-ast in preparation for backend parametrisation
-rw-r--r-- | ast/CC/Context.hs | 5 | ||||
-rw-r--r-- | compcomp.cabal | 4 | ||||
-rw-r--r-- | main/Main.hs | 2 | ||||
-rw-r--r-- | parser/CC/Parser.hs | 1 | ||||
-rw-r--r-- | typecheck/CC/Typecheck.hs | 1 | ||||
-rw-r--r-- | utils/CC/Types.hs | 3 |
6 files changed, 10 insertions, 6 deletions
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) |