45 lines
1.2 KiB
Haskell
45 lines
1.2 KiB
Haskell
|
module Language.Elna.Intermediate
|
||
|
( Label(..)
|
||
|
, Operand(..)
|
||
|
, Quadruple(..)
|
||
|
, Variable(..)
|
||
|
) where
|
||
|
|
||
|
import Data.Int (Int32)
|
||
|
import Data.Word (Word32)
|
||
|
import Data.Text (Text)
|
||
|
|
||
|
data Operand
|
||
|
= VariableOperand Text
|
||
|
| IntOperand Int32
|
||
|
deriving (Eq, Show)
|
||
|
|
||
|
newtype Label = Label Text
|
||
|
deriving (Eq, Show)
|
||
|
|
||
|
newtype Variable = Variable Text
|
||
|
deriving (Eq, Show)
|
||
|
|
||
|
data Quadruple
|
||
|
= StartQuadruple
|
||
|
| GoToQuadruple Label
|
||
|
| AssignQuadruple Operand Variable
|
||
|
| ArrayQuadruple Variable Word32 Variable
|
||
|
| ArrayAssignQuadruple Operand Word32 Variable
|
||
|
| AddQuadruple Operand Operand Variable
|
||
|
| SubtractionQuadruple Operand Operand Variable
|
||
|
| ProductQuadruple Operand Operand Variable
|
||
|
| DivisionQuadruple Operand Operand Variable
|
||
|
| NegationQuadruple Operand Variable
|
||
|
| EqualQuadruple Operand Operand Label
|
||
|
| NonEqualQuadruple Operand Operand Label
|
||
|
| LessQuadruple Operand Operand Label
|
||
|
| GreaterQuadruple Operand Operand Label
|
||
|
| LessOrEqualQuadruple Operand Operand Label
|
||
|
| GreaterOrEqualQuadruple Operand Operand Label
|
||
|
| LabelQuadruple Label
|
||
|
| ParameterQuadruple Operand
|
||
|
| CallQuadruple Variable Word32
|
||
|
| StopQuadruple
|
||
|
deriving (Eq, Show)
|