diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-07-26 12:22:07 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-07-26 12:22:07 +0200 |
| commit | ce7652c6189b289ffbc749dc3d1ffb465c758c01 (patch) | |
| tree | e3f059ceb8fdaf3153d49d894d695fc5825021c5 /lib/Language/Elna/AST.hs | |
| parent | bf774475cc21cf7190144a5a9e16c2a72318f0bb (diff) | |
| download | elna-ce7652c6189b289ffbc749dc3d1ffb465c758c01.tar.gz | |
Add types for name analysis
Diffstat (limited to 'lib/Language/Elna/AST.hs')
| -rw-r--r-- | lib/Language/Elna/AST.hs | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/Language/Elna/AST.hs b/lib/Language/Elna/AST.hs index 3189469..189fcb5 100644 --- a/lib/Language/Elna/AST.hs +++ b/lib/Language/Elna/AST.hs @@ -12,34 +12,20 @@ module Language.Elna.AST import Data.Int (Int32) import Data.List (intercalate) -import Data.Word (Word16) -import Data.Text (Text) -import qualified Data.Text as Text +import Data.Word (Word16, Word32) import Data.Char (chr) -import Data.String (IsString(..)) +import Language.Elna.Location (Identifier(..), showArrayType) import Numeric (showHex) -newtype Identifier = Identifier { unIdentifier :: Text } - deriving Eq - -instance Show Identifier - where - show (Identifier identifier) = Text.unpack identifier - -instance IsString Identifier - where - fromString = Identifier . Text.pack - data TypeExpression = NamedType Identifier - | ArrayType TypeExpression Int32 + | ArrayType Word32 TypeExpression deriving Eq instance Show TypeExpression where show (NamedType typeName) = show typeName - show (ArrayType typeName elementCount) = concat - [show typeName, "[", show elementCount, "]"] + show (ArrayType elementCount typeName) = showArrayType elementCount typeName data Literal = IntegerLiteral Int32 |
