Skip to content

Commit

Permalink
Remove abstract (#2219)
Browse files Browse the repository at this point in the history
- Closes #2002 
- Closes #1690 
- Closes #2224
- Closes #2237
  • Loading branch information
janmasrovira authored Jun 30, 2023
1 parent 38028d2 commit d69d8c6
Show file tree
Hide file tree
Showing 76 changed files with 2,321 additions and 2,919 deletions.
12 changes: 7 additions & 5 deletions app/Commands/Dev/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ module Commands.Dev.Internal where
import Commands.Base
import Commands.Dev.Internal.Arity qualified as Arity
import Commands.Dev.Internal.Options
import Commands.Dev.Internal.Pretty qualified as InternalPretty
import Commands.Dev.Internal.Typecheck qualified as InternalTypecheck
import Commands.Dev.Internal.Pretty qualified as Pretty
import Commands.Dev.Internal.Reachability qualified as Reachability
import Commands.Dev.Internal.Typecheck qualified as Typecheck

runCommand :: (Members '[Embed IO, App] r) => InternalCommand -> Sem r ()
runCommand :: Members '[Embed IO, App] r => InternalCommand -> Sem r ()
runCommand = \case
Pretty opts -> InternalPretty.runCommand opts
Pretty opts -> Pretty.runCommand opts
Arity opts -> Arity.runCommand opts
TypeCheck opts -> InternalTypecheck.runCommand opts
TypeCheck opts -> Typecheck.runCommand opts
Reachability opts -> Reachability.runCommand opts
14 changes: 13 additions & 1 deletion app/Commands/Dev/Internal/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ module Commands.Dev.Internal.Options where

import Commands.Dev.Internal.Arity.Options
import Commands.Dev.Internal.Pretty.Options
import Commands.Dev.Internal.Reachability.Options
import Commands.Dev.Internal.Typecheck.Options
import CommonOptions

data InternalCommand
= Pretty InternalPrettyOptions
| TypeCheck InternalTypeOptions
| Arity InternalArityOptions
| Reachability InternalReachabilityOptions
deriving stock (Data)

parseInternalCommand :: Parser InternalCommand
Expand All @@ -17,7 +19,8 @@ parseInternalCommand =
mconcat
[ commandPretty,
commandArity,
commandTypeCheck
commandTypeCheck,
commandReachability
]
where
commandArity :: Mod CommandFields InternalCommand
Expand All @@ -29,6 +32,9 @@ parseInternalCommand =
commandTypeCheck :: Mod CommandFields InternalCommand
commandTypeCheck = command "typecheck" typeCheckInfo

commandReachability :: Mod CommandFields InternalCommand
commandReachability = command "reachability" reachabilityInfo

arityInfo :: ParserInfo InternalCommand
arityInfo =
info
Expand All @@ -46,3 +52,9 @@ parseInternalCommand =
info
(TypeCheck <$> parseInternalType)
(progDesc "Translate a Juvix file to Internal and typecheck the result")

reachabilityInfo :: ParserInfo InternalCommand
reachabilityInfo =
info
(Reachability <$> parseInternalReachability)
(progDesc "Print reachability information")
2 changes: 1 addition & 1 deletion app/Commands/Dev/Internal/Pretty.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Commands.Dev.Internal.Pretty where
import Commands.Base
import Commands.Dev.Internal.Pretty.Options
import Juvix.Compiler.Internal.Pretty qualified as Internal
import Juvix.Compiler.Internal.Translation.FromAbstract qualified as Internal
import Juvix.Compiler.Internal.Translation.FromConcrete qualified as Internal

runCommand :: (Members '[Embed IO, App] r) => InternalPrettyOptions -> Sem r ()
runCommand opts = do
Expand Down
12 changes: 12 additions & 0 deletions app/Commands/Dev/Internal/Reachability.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module Commands.Dev.Internal.Reachability where

import Commands.Base
import Commands.Dev.Internal.Reachability.Options
import Juvix.Compiler.Internal.Pretty qualified as Internal
import Juvix.Compiler.Internal.Translation.FromConcrete qualified as Internal

runCommand :: (Members '[Embed IO, App] r) => InternalReachabilityOptions -> Sem r ()
runCommand opts = do
globalOpts <- askGlobalOptions
depInfo <- (^. Internal.resultDepInfo) <$> runPipeline (opts ^. internalReachabilityInputFile) upToInternal
renderStdOut (Internal.ppOut globalOpts depInfo)
15 changes: 15 additions & 0 deletions app/Commands/Dev/Internal/Reachability/Options.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Commands.Dev.Internal.Reachability.Options where

import CommonOptions

newtype InternalReachabilityOptions = InternalReachabilityOptions
{ _internalReachabilityInputFile :: AppPath File
}
deriving stock (Data)

makeLenses ''InternalReachabilityOptions

parseInternalReachability :: Parser InternalReachabilityOptions
parseInternalReachability = do
_internalReachabilityInputFile <- parseInputJuvixFile
pure InternalReachabilityOptions {..}
3 changes: 1 addition & 2 deletions app/Commands/Dev/Termination/CallGraph.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import Commands.Dev.Termination.CallGraph.Options
import Data.HashMap.Strict qualified as HashMap
import Juvix.Compiler.Internal.Language qualified as Internal
import Juvix.Compiler.Internal.Pretty qualified as Internal
-- import Juvix.Compiler.Internal.Translation.FromConcrete qualified as Internal
import Juvix.Compiler.Internal.Translation.FromAbstract.Data.Context qualified as Internal
import Juvix.Compiler.Internal.Translation.FromConcrete.Data.Context qualified as Internal
import Juvix.Compiler.Internal.Translation.FromInternal.Analysis.Termination qualified as Termination
import Juvix.Prelude.Pretty

Expand Down
2 changes: 1 addition & 1 deletion app/Commands/Dev/Termination/Calls.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Commands.Base
import Commands.Dev.Termination.Calls.Options
import Juvix.Compiler.Internal.Data.InfoTable qualified as Internal
import Juvix.Compiler.Internal.Pretty qualified as Internal
import Juvix.Compiler.Internal.Translation.FromAbstract qualified as Internal
import Juvix.Compiler.Internal.Translation.FromConcrete qualified as Internal
import Juvix.Compiler.Internal.Translation.FromInternal.Analysis.Termination qualified as Termination

runCommand :: Members '[Embed IO, App] r => CallsOptions -> Sem r ()
Expand Down
7 changes: 0 additions & 7 deletions app/GlobalOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module GlobalOptions
where

import CommonOptions
import Juvix.Compiler.Abstract.Pretty.Options qualified as Abstract
import Juvix.Compiler.Core.Options qualified as Core
import Juvix.Compiler.Internal.Pretty.Options qualified as Internal
import Juvix.Compiler.Pipeline
Expand Down Expand Up @@ -32,12 +31,6 @@ instance CanonicalProjection GlobalOptions Internal.Options where
{ Internal._optShowNameIds = g ^. globalShowNameIds
}

instance CanonicalProjection GlobalOptions Abstract.Options where
project g =
Abstract.defaultOptions
{ Abstract._optShowNameIds = g ^. globalShowNameIds
}

instance CanonicalProjection GlobalOptions E.GenericOptions where
project GlobalOptions {..} =
E.GenericOptions
Expand Down
10 changes: 0 additions & 10 deletions src/Juvix/Compiler/Abstract/Data.hs

This file was deleted.

44 changes: 0 additions & 44 deletions src/Juvix/Compiler/Abstract/Data/InfoTable.hs

This file was deleted.

71 changes: 0 additions & 71 deletions src/Juvix/Compiler/Abstract/Data/InfoTableBuilder.hs

This file was deleted.

10 changes: 0 additions & 10 deletions src/Juvix/Compiler/Abstract/Data/NameDependencyInfo.hs

This file was deleted.

10 changes: 0 additions & 10 deletions src/Juvix/Compiler/Abstract/Extra.hs

This file was deleted.

Loading

0 comments on commit d69d8c6

Please sign in to comment.