Copyright | (c) Eric Mertens 2017 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | None |
Language | Haskell2010 |
https://adventofcode.com/2017/day/8
Day 8 poses a problem of parsing a simple programming language, executing it, and computing simple metrics on the values stored in variables during execution.
>>>
:{
:main + "b inc 5 if a > 1\n\ \a inc 1 if b < 5\n\ \c dec -10 if a >= 1\n\ \c inc -20 if c == 10\n" :} 1 10
Documentation
Compute solution to Day 8. Input file can be overridden with command-line arguments.
>>>
:main
4163 5347
:: Map String Int | incoming registers |
-> (String, C, Int, String, String, Int) | statement |
-> Map String Int | outgoing registers |
Given registers and a statement, compute the resulting registers.
Convert the string representation of a comparison to a function.