projects
/
advent-of-code-16.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
879988b
)
Tidying
author
Neil Smith
<neil.git@njae.me.uk>
Fri, 23 Dec 2016 18:30:59 +0000
(18:30 +0000)
committer
Neil Smith
<neil.git@njae.me.uk>
Fri, 23 Dec 2016 18:30:59 +0000
(18:30 +0000)
adventofcode16/app/advent23.hs
patch
|
blob
|
history
diff --git
a/adventofcode16/app/advent23.hs
b/adventofcode16/app/advent23.hs
index 42cd15f2c24ca07570df285045b35368821776ed..20c4a15154df24f540eb67119acb9cd1b4c6e51c 100644
(file)
--- a/
adventofcode16/app/advent23.hs
+++ b/
adventofcode16/app/advent23.hs
@@
-160,14
+160,9
@@
writeValue m (Register r) v =
instructionFile = instructionLine `sepEndBy` newline
instructionFile = instructionLine `sepEndBy` newline
--- instructionLine = choice [cpyL, incL, decL, jnzL]
instructionLine = incL <|> decL <|> cpyL <|> jnzL <|> tglL
instructionLine = incL <|> decL <|> cpyL <|> jnzL <|> tglL
--- incL = incify <$> (string "inc" *> spaces *> (oneOf "abcd"))
--- where incify r = Inc (Register r)
incL = (Inc . Register) <$> (string "inc" *> spaces *> (oneOf "abcd"))
incL = (Inc . Register) <$> (string "inc" *> spaces *> (oneOf "abcd"))
--- decL = decify <$> (string "dec" *> spaces *> (oneOf "abcd"))
--- where decify r = Dec (Register r)
decL = (Dec . Register) <$> (string "dec" *> spaces *> (oneOf "abcd"))
cpyL = cpyify <$> (string "cpy" *> spaces *> ((Literal <$> int) <|> ((Register . head) <$> (many1 letter))))
<*> (spaces *> (oneOf "abcd"))
decL = (Dec . Register) <$> (string "dec" *> spaces *> (oneOf "abcd"))
cpyL = cpyify <$> (string "cpy" *> spaces *> ((Literal <$> int) <|> ((Register . head) <$> (many1 letter))))
<*> (spaces *> (oneOf "abcd"))
@@
-176,16
+171,6
@@
jnzL = jnzify <$> (string "jnz" *> spaces *> ((Literal <$> int) <|> ((Register .
<*> (spaces *> ((Literal <$> int) <|> ((Register . head) <$> (many1 letter))))
where jnzify r o = Jnz r o
tglL = Tgl <$> (string "tgl" *> spaces *> ((Literal <$> int) <|> ((Register . head) <$> (many1 letter))))
<*> (spaces *> ((Literal <$> int) <|> ((Register . head) <$> (many1 letter))))
where jnzify r o = Jnz r o
tglL = Tgl <$> (string "tgl" *> spaces *> ((Literal <$> int) <|> ((Register . head) <$> (many1 letter))))
- -- where tglify r = Tgl r
-
-
--- readLocation :: Int -> Location
--- readLocation l = Literal l
-
--- readLocation :: String -> Location
--- readLocation l
--- | all (isDigit) l = Literal (read l)
--- | otherwise = Register (head l)
parseIfile :: String -> Either ParseError [Instruction]
parseIfile input = parse instructionFile "(unknown)" input
parseIfile :: String -> Either ParseError [Instruction]
parseIfile input = parse instructionFile "(unknown)" input