From 0274c964874801d7cbde8f13fa13e11ed7948660 Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Wed, 25 Sep 2024 22:51:32 -0600 Subject: feat: Add AdvanceStage typeclass and refactor code to use it Introduced the `AdvanceStage` typeclass, which provides a mechanism to transition AST elements between different compilation stages. This abstraction facilitates easier traversal and modification of the syntax tree as it progresses through various compilation phases. --- src/Language/Fiddle/Ast/FileInterface.hs | 55 +++++++++++++++++--------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'src/Language/Fiddle/Ast/FileInterface.hs') diff --git a/src/Language/Fiddle/Ast/FileInterface.hs b/src/Language/Fiddle/Ast/FileInterface.hs index d29fc9d..c1cfac8 100644 --- a/src/Language/Fiddle/Ast/FileInterface.hs +++ b/src/Language/Fiddle/Ast/FileInterface.hs @@ -6,28 +6,33 @@ module Language.Fiddle.Ast.FileInterface where -- the import statements should supply an fdi (fiddle interface) file to speed -- up subsequent compilations. --- import Data.Text --- --- 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 FileInterface a = FiddleInterface --- { exportedElements :: [Element a] --- } +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] + } -- cgit