Model virtual machine ADT

This commit is contained in:
2021-11-02 16:15:12 +01:00
parent 3290b3bc33
commit d1c3b8a3cb
2 changed files with 22 additions and 1 deletions

View File

@@ -24,7 +24,8 @@ executable MVM
main-is: Main.hs
-- Modules included in this executable, other than Main.
-- other-modules:
other-modules:
VirtualMachine
-- LANGUAGE extensions used by modules in this package.
-- other-extensions:

20
app/VirtualMachine.hs Normal file
View File

@@ -0,0 +1,20 @@
module VirtualMachine (
VM(..),
empty
)
where
import qualified Data.Sequence as S
data VM = VM { pc :: Int
, fp :: Int
, stack :: S.Seq Int
, halt :: Bool
} deriving (Show, Eq)
empty :: VM
empty = VM { pc = -1
, fp = -1
, stack = S.empty
, halt = False
}