-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d23482
commit c001ad2
Showing
4 changed files
with
44 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module CmdLine where | ||
|
||
import Options.Applicative | ||
|
||
-- import Data.String.Interpolate (i) | ||
-- import TIS100 | ||
|
||
-- main :: IO () | ||
-- main = do | ||
-- let a = 1 | ||
-- let b = 2 | ||
-- putStrLn [i| Sum of #{a} and #{b} is #{sum' a b}|] | ||
|
||
data CmdLineOpts = CmdLineOpts | ||
{ asmFilePath :: String | ||
} | ||
|
||
sample :: Parser CmdLineOpts | ||
sample = | ||
CmdLineOpts | ||
<$> strArgument | ||
( metavar "ASMFILE" | ||
<> help "Assembly file name" | ||
) | ||
|
||
greet :: CmdLineOpts -> IO () | ||
greet (CmdLineOpts asmFilePath) = putStrLn $ "asm: " ++ asmFilePath | ||
greet _ = return () |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
{-# LANGUAGE QuasiQuotes #-} | ||
|
||
module Main where | ||
|
||
import Lib | ||
import Data.String.Interpolate (i) | ||
import CmdLine | ||
import Options.Applicative | ||
|
||
main :: IO () | ||
main = do | ||
let a = 1 | ||
let b = 2 | ||
putStrLn [i| Sum of #{a} and #{b} is #{sum' a b}|] | ||
main = greet =<< execParser opts | ||
where | ||
opts = | ||
info | ||
(sample <**> helper) | ||
( fullDesc | ||
<> progDesc "Print a greeting for TARGET" | ||
<> header "hello - a test for optparse-applicative" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
module TIS100.Simulator.CPU where | ||
|
||
import Data.Vector.Mutable | ||
import TIS100.Nodes.T21 (T21 (..)) | ||
import TIS100.Nodes.T30 (T30 (..)) | ||
|
||
data Node = InactiveNode | Node21 T21 | Node30 T30 | ||
deriving (Eq, Show) | ||
|
||
type CPUState m = MVector m Node |