summaryrefslogtreecommitdiff
path: root/src/Language/Fiddle/Ast/FileInterface.hs
blob: c1cfac81f613740b83c79bc8d0c6b745bbf7bc44 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module Language.Fiddle.Ast.FileInterface where

-- Definitions for file interfaces. These interfaces contain an abstract
-- representation of the symbols and information exported by a fiddle file.
-- These interfaces are also serializable, and when compiling a fiddle file, all
-- the import statements should supply an fdi (fiddle interface) file to speed
-- up subsequent compilations.

import Data.Text
import Data.Word

data ObjectType = ObjectType
  { objectTypeSize :: Word32
  }

data Metatype
  = Object
      { objectLocation :: Word64,
        objectType :: Text
      }
  | Type
      { typeSizeBytes :: Word32
      }

data Element a = Element
  { elementFullyQualifiedSymbol :: Text,
    elementDocumentation :: Maybe Text,
    elementMetatype :: Metatype,
    elementAnnotation :: a
  }

data ResolvedImport a = ResolvedImport {
  dependencies :: [String]
}

data FileInterface a = FiddleInterface
  { exportedElements :: [Element a]
  }