18 lines
699 B
Haskell
18 lines
699 B
Haskell
module Language.Elna.CodeGenerator
|
|
( generateCode
|
|
) where
|
|
|
|
import Data.Vector (Vector)
|
|
import qualified Data.Vector as Vector
|
|
import Language.Elna.Intermediate (Quadruple(..))
|
|
import qualified Language.Elna.Architecture.RiscV as RiscV
|
|
import Language.Elna.SymbolTable (SymbolTable)
|
|
|
|
generateCode :: SymbolTable -> Vector Quadruple -> Vector RiscV.Instruction
|
|
generateCode _ _ = Vector.fromList
|
|
[ RiscV.CallInstruction "printi"
|
|
, RiscV.Instruction RiscV.OpImm $ RiscV.I RiscV.A0 RiscV.ADDI RiscV.Zero 0
|
|
, RiscV.Instruction RiscV.OpImm $ RiscV.I RiscV.A7 RiscV.ADDI RiscV.Zero 93
|
|
, RiscV.Instruction RiscV.System $ RiscV.Type RiscV.Zero RiscV.PRIV RiscV.Zero RiscV.ECALL
|
|
]
|