Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit e4281d5

Browse files
authored
Merge pull request #659 from github/abstract-normalization-by-abstract-evaluation
Parametric modular interpretation
2 parents e9e1f01 + 26655c2 commit e4281d5

49 files changed

Lines changed: 920 additions & 1929 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/haskell.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
cabal v2-run --project-file=cabal.project.ci semantic:test
5959
cabal v2-run --project-file=cabal.project.ci semantic-tags:test
6060
cabal v2-run --project-file=cabal.project.ci semantic-codeql:test
61-
cabal v2-run --project-file=cabal.project.ci semantic-core:test
6261
cabal v2-run --project-file=cabal.project.ci semantic-go:test
6362
cabal v2-run --project-file=cabal.project.ci semantic-java:test
6463
cabal v2-run --project-file=cabal.project.ci semantic-json:test

WORKSPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ stack_snapshot(
8282
"fused-effects",
8383
"fused-effects-exceptions",
8484
"fused-effects-readline",
85-
"fused-syntax",
8685
"gauge",
8786
"generic-lens",
8887
"generic-monoid",

build/common.bzl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ def semantic_language_library(language, name, srcs, ts_package = "", nodetypes =
127127
"@stackage//:aeson",
128128
"@stackage//:algebraic-graphs",
129129
"@stackage//:fused-effects",
130-
"@stackage//:fused-syntax",
131130
"@stackage//:generic-lens",
132131
"@stackage//:hashable",
133132
"@stackage//:lens",

cabal.project

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,3 @@ packages: semantic
2020
semantic-tags
2121
semantic-tsx
2222
semantic-typescript
23-
24-
source-repository-package
25-
type: git
26-
location: https://github.com/antitypical/fused-syntax.git
27-
tag: 4a383d57c8fd7592f54a33f43eb9666314a6e80e

cabal.project.ci

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ packages: semantic
2121
semantic-tsx
2222
semantic-typescript
2323

24-
source-repository-package
25-
type: git
26-
location: https://github.com/antitypical/fused-syntax.git
27-
tag: 4a383d57c8fd7592f54a33f43eb9666314a6e80e
28-
2924
-- Treat warnings as errors for CI builds
3025
package semantic
3126
ghc-options: -Werror

semantic-analysis/BUILD.bazel

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,8 @@ haskell_library(
2727
"//:transformers",
2828
"//semantic-source",
2929
"@stackage//:aeson",
30-
"@stackage//:algebraic-graphs",
3130
"@stackage//:fused-effects",
32-
"@stackage//:fused-effects-readline",
33-
"@stackage//:fused-syntax",
3431
"@stackage//:hashable",
35-
"@stackage//:haskeline",
3632
"@stackage//:pathtype",
37-
"@stackage//:prettyprinter",
38-
"@stackage//:prettyprinter-ansi-terminal",
39-
"@stackage//:semilattices",
40-
"@stackage//:terminal-size",
4133
],
4234
)

semantic-analysis/semantic-analysis.cabal

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,25 @@ library
4545
hs-source-dirs: src
4646
exposed-modules:
4747
Analysis.Blob
48-
Analysis.Carrier.Env.Monovariant
49-
Analysis.Carrier.Env.Precise
50-
Analysis.Carrier.Heap.Monovariant
51-
Analysis.Carrier.Heap.Precise
48+
Analysis.Carrier.Fail.WithLoc
49+
Analysis.Carrier.Store.Monovariant
50+
Analysis.Carrier.Store.Precise
5251
Analysis.Concrete
5352
Analysis.Effect.Domain
5453
Analysis.Effect.Env
55-
Analysis.Effect.Heap
54+
Analysis.Effect.Store
5655
Analysis.File
5756
Analysis.FlowInsensitive
5857
Analysis.Functor.Named
59-
Analysis.ImportGraph
60-
Analysis.Intro
6158
Analysis.Name
6259
Analysis.Project
60+
Analysis.Reference
6361
Analysis.Typecheck
64-
Control.Carrier.Fail.WithLoc
6562
build-depends:
6663
, aeson ^>= 1.4
67-
, algebraic-graphs ^>= 0.3
6864
, base >= 4.13 && < 5
6965
, containers ^>= 0.6
7066
, fused-effects ^>= 1.1
71-
, fused-syntax
7267
, hashable
7368
, pathtype ^>= 0.8.1
7469
, semantic-source ^>= 0.1.0.1

semantic-analysis/src/Analysis/Blob.hs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ module Analysis.Blob
88
, nullBlob
99
) where
1010

11-
import Analysis.File
11+
import Analysis.File as A
12+
import Analysis.Reference as A
1213
import Data.Aeson
1314
import Source.Language as Language
1415
import Source.Source as Source
@@ -34,13 +35,13 @@ instance FromJSON Blob where
3435
-- The resulting Blob's span is taken from the 'totalSpan' of the source.
3536
fromSource :: Path.PartClass.AbsRel ar => Path.File ar -> Language -> Source -> Blob
3637
fromSource filepath language source
37-
= Blob source (Analysis.File.File (Path.toAbsRel filepath) (totalSpan source) language)
38+
= Blob source (A.File (A.Reference (Path.toAbsRel filepath) (totalSpan source)) language)
3839

3940
blobLanguage :: Blob -> Language
40-
blobLanguage = Analysis.File.fileBody . blobFile
41+
blobLanguage = A.fileBody . blobFile
4142

4243
blobPath :: Blob -> Path.AbsRelFile
43-
blobPath = Analysis.File.filePath . blobFile
44+
blobPath = A.refPath . A.fileRef . blobFile
4445

4546
-- | Show FilePath for error or json outputs.
4647
blobFilePath :: Blob -> String

semantic-analysis/src/Analysis/Carrier/Env/Monovariant.hs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ newtype EnvC m a = EnvC { runEnv :: m a }
2222
instance Algebra sig m
2323
=> Algebra (Env Name :+: sig) (EnvC m) where
2424
alg hdl sig ctx = case sig of
25-
L (Alloc name) -> pure (name <$ ctx)
2625
L (Bind _ _ m) -> hdl (m <$ ctx)
2726
L (Lookup name) -> pure (Just name <$ ctx)
2827
R other -> EnvC (alg (runEnv . hdl) other ctx)

semantic-analysis/src/Analysis/Carrier/Env/Precise.hs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,25 @@ module Analysis.Carrier.Env.Precise
88
( -- * Env carrier
99
EnvC(..)
1010
-- * Env effect
11-
, A.alloc
12-
, A.bind
13-
, A.lookupEnv
14-
, A.Env(..)
11+
, module Analysis.Effect.Env
1512
) where
1613

17-
import qualified Analysis.Effect.Env as A
14+
import Analysis.Effect.Env
1815
import Analysis.Name
1916
import Control.Algebra
20-
import Control.Effect.Fresh
2117
import Control.Effect.Reader
2218
import qualified Control.Monad.Fail as Fail
2319
import qualified Data.Map as Map
2420

2521
type Precise = Int
26-
type Env = Map.Map Name Precise
22+
type PreciseEnv = Map.Map Name Precise
2723

2824
newtype EnvC m a = EnvC { runEnv :: m a }
2925
deriving (Applicative, Functor, Monad, Fail.MonadFail)
3026

31-
instance ( Has Fresh sig m
32-
, Has (Reader Env) sig m
33-
)
34-
=> Algebra (A.Env Precise :+: sig) (EnvC m) where
27+
instance Has (Reader PreciseEnv) sig m
28+
=> Algebra (Env Precise :+: sig) (EnvC m) where
3529
alg hdl sig ctx = case sig of
36-
L (A.Alloc _) -> (<$ ctx) <$> fresh
37-
L (A.Bind name addr m) -> local (Map.insert name addr) (hdl (m <$ ctx))
38-
L (A.Lookup name) -> (<$ ctx) <$> asks (Map.lookup name)
39-
R other -> EnvC (alg (runEnv . hdl) other ctx)
30+
L (Bind name addr m) -> local (Map.insert name addr) (hdl (m <$ ctx))
31+
L (Lookup name) -> (<$ ctx) <$> asks (Map.lookup name)
32+
R other -> EnvC (alg (runEnv . hdl) other ctx)

0 commit comments

Comments
 (0)