diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2024-09-22 00:26:39 -0600 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2024-09-22 00:26:39 -0600 |
commit | 0d2095b5d42989639c1861d7213c182abd064672 (patch) | |
tree | e7d43320521f6bfb57d214cb949db8c8674c18c5 /src/Language/Fiddle/GenericTree.hs | |
parent | f0c4da33e9576d2509b8c6330b1663e044e2dff3 (diff) | |
download | fiddle-0d2095b5d42989639c1861d7213c182abd064672.tar.gz fiddle-0d2095b5d42989639c1861d7213c182abd064672.tar.bz2 fiddle-0d2095b5d42989639c1861d7213c182abd064672.zip |
More major changes to the grammer.
Added annotation sublanguage for defining compiler directives. Also
added the syntax for import statements. Imports are not implemented, but
I'm currently working on that.
Diffstat (limited to 'src/Language/Fiddle/GenericTree.hs')
-rw-r--r-- | src/Language/Fiddle/GenericTree.hs | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/Language/Fiddle/GenericTree.hs b/src/Language/Fiddle/GenericTree.hs index 00824ed..46c0594 100644 --- a/src/Language/Fiddle/GenericTree.hs +++ b/src/Language/Fiddle/GenericTree.hs @@ -28,7 +28,12 @@ import Language.Fiddle.Types import Text.Parsec.Pos import Text.Printf (printf) -type Context stage = (Show (NumberType stage), Typeable stage) +type Context stage = + ( Show (NumberType stage), + Typeable stage, + ToGenericSyntaxTree (ImportType stage), + Typeable (ImportType stage) + ) data GenericSyntaxTree f a where {- GenericSyntaxtTree with a name and children. -} @@ -94,7 +99,7 @@ instance ToGenericSyntaxTreeValue Data.Text.Text where type GenericContext t f a = (Traversable f, ToGenericSyntaxTree t, Typeable t, Typeable f, Typeable a) -class ToGenericSyntaxTree (t :: (Type -> Type) -> Type -> Type) where +class ToGenericSyntaxTree (t :: SynTreeKind) where toGenericSyntaxTree :: (Traversable f, Typeable f, Typeable t, Typeable a) => t f a -> GenericSyntaxTree f a default toGenericSyntaxTree :: (GenericContext t f a, Generic (t f a), (GToGenericSyntaxTree (Rep (t f a)) f a)) => @@ -176,6 +181,20 @@ deriving instance (ToGenericSyntaxTree Identifier) deriving instance (ToGenericSyntaxTree BodyType) +deriving instance (ToGenericSyntaxTree Directive) + +deriving instance (ToGenericSyntaxTree DirectiveBody) + +deriving instance (ToGenericSyntaxTree DirectiveElement) + +deriving instance (ToGenericSyntaxTree DirectiveExpression) + +deriving instance (ToGenericSyntaxTree ImportList) + +deriving instance (ToGenericSyntaxTree ImportStatement) + +deriving instance (ToGenericSyntaxTree t, Typeable t) => (ToGenericSyntaxTree (Directed t)) + deriving instance (Context stage) => (ToGenericSyntaxTree (FiddleUnit stage)) deriving instance (Context stage) => (ToGenericSyntaxTree (FiddleDecl stage)) |