This repository was archived by the owner on Apr 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
semantic-analysis/src/Analysis/Syntax Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88-- | This belongs in @semantic-python@ instead of @semantic-analysis@, but for the sake of expedience…
99module Analysis.Syntax.Python
1010( -- * Syntax
11- Term (.. )
12- , subterms
11+ T. Term (.. )
1312, Python (.. )
1413, pattern Noop''
1514, pattern Iff''
@@ -37,45 +36,11 @@ import Control.Effect.Labelled
3736import Control.Effect.Reader
3837import Data.Function (fix )
3938import Data.List.NonEmpty (NonEmpty )
40- import qualified Data.Set as Set
4139import Data.Text (Text )
4240import Source.Span (Span )
4341
4442-- Syntax
4543
46- data Term
47- = Var Name
48- | Noop
49- | Iff Term Term Term
50- | Bool Bool
51- | String Text
52- | Throw Term
53- | Let Name Term Term
54- | Term :>> Term
55- | Import (NonEmpty Text )
56- | Function Name [Name ] Term
57- | Call Term [Term ]
58- | Locate Span Term
59- deriving (Eq , Ord , Show )
60-
61- infixl 1 :>>
62-
63- subterms :: Term -> Set. Set Term
64- subterms t = Set. singleton t <> case t of
65- Var _ -> mempty
66- Noop -> mempty
67- Iff c t e -> subterms c <> subterms t <> subterms e
68- Bool _ -> mempty
69- String _ -> mempty
70- Throw t -> subterms t
71- Let _ v b -> subterms v <> subterms b
72- a :>> b -> subterms a <> subterms b
73- Import _ -> mempty
74- Function _ _ b -> subterms b
75- Call f as -> subterms f <> foldMap subterms as
76- Locate _ b -> subterms b
77-
78-
7944data Python (arity :: T. Nat ) where
8045 Noop' :: Python T. N0
8146 Iff' :: Python T. N3
You can’t perform that action at this time.
0 commit comments