elna/lib/Language/Elna/CodeGenerator.hs

17 lines
662 B
Haskell
Raw Normal View History

2024-08-30 14:55:40 +02:00
module Language.Elna.CodeGenerator
2024-09-08 02:08:13 +02:00
( generateCode
2024-08-30 14:55:40 +02:00
) where
2024-09-08 02:08:13 +02:00
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.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
]