59 lines
1.6 KiB
Haskell
59 lines
1.6 KiB
Haskell
-- Haskell data types for the abstract syntax.
|
|
-- Generated by the BNF converter.
|
|
|
|
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
|
|
|
|
module Language.Lang.AbsGrammer where
|
|
|
|
import Prelude (Char, Double, Integer, String)
|
|
import qualified Prelude as C (Eq, Ord, Show, Read)
|
|
import qualified Data.String
|
|
|
|
newtype Name = Name String
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read, Data.String.IsString)
|
|
|
|
newtype NumericLiteral = NumericLiteral String
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read, Data.String.IsString)
|
|
|
|
data Module = Module [Binding]
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
|
|
|
data Binding
|
|
= BindingDeclaration Declaration
|
|
| BindingDefinition Definition
|
|
| BindingPragma Pragma
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
|
|
|
data Declaration
|
|
= DeclarationNamed Name Type | DeclarationAnonymous Type
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
|
|
|
data Definition
|
|
= DefinitionNamed Name Expression | DefinitionAnonymous Expression
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
|
|
|
data Type
|
|
= TypeName Name
|
|
| TypeApplication Type Type
|
|
| TypeAbstraction Type Type
|
|
| TypeImplicit [Declaration]
|
|
| TypeRecord [Declaration]
|
|
| TypeAlternative [Declaration]
|
|
| TypeParens Type
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
|
|
|
data Pragma = Pragma [Name]
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
|
|
|
data Expression
|
|
= ExpressionName Name
|
|
| ExpressionLiteral NumericLiteral
|
|
| ExpressionApplication Expression Expression
|
|
| ExpressionAbstraction Expression Expression
|
|
| ExpressionImplicit Module
|
|
| ExpressionRecord Module
|
|
| ExpressionAlternative Module
|
|
| ExpressionParens Expression
|
|
deriving (C.Eq, C.Ord, C.Show, C.Read)
|
|
|