on 267f708 help sign in
elk/src/AST/Literal.hs
54 lines 995 B history raw
1{-# OPTIONS_GHC -Wall #-}
2module AST.Literal where
4import qualified Data.Map as Map
7data Literal
8 = IntNum Int
9 | FloatNum Double
10 | Chr Char
11 | Str String
12 | Boolean Bool
13 deriving (Eq, Ord)
16toString :: Literal -> String
17toString literal =
18 case literal of
19 IntNum n -> show n
20 FloatNum n -> show n
21 Chr c -> show c
22 Str s -> show s
23 Boolean bool -> show bool
26data GLTipe
27 = Int
28 | Float
29 | V2
30 | V3
31 | V4
32 | M4
33 | Texture
34 deriving (Eq)
37glTipeName :: GLTipe -> String
38glTipeName glTipe =
39 case glTipe of
40 Int -> "Int"
41 Float -> "Float"
42 V2 -> "Math.Vector2.Vec2"
43 V3 -> "Math.Vector3.Vec3"
44 V4 -> "Math.Vector4.Vec4"
45 M4 -> "Math.Matrix4.Mat4"
46 Texture -> "WebGL.Texture"
49data GLShaderTipe = GLShaderTipe
50 { attribute :: Map.Map String GLTipe
51 , uniform :: Map.Map String GLTipe
52 , varying :: Map.Map String GLTipe
53 }
54 deriving (Eq)