Keg + Reg, 17-ir
, 16 bytes
"(!;2/|';½|':"=['_"|_
I know it isnt the nicest looking answer, but it beats Brachylog, so I'm happy with that.Try it online!
Explained:
Takes the implicit input and right shifts the accumulators value to the bottom
Repeat the following (length of stack - 1 divided by 2) times
2.1. Shift the accumulator back to the top
2.2. Compare for equality with the first part of the command
2.2.1. If true, replace the accumulator, otherwise pop the replacement
Input is taken as the initial acc value concatenated with the source. E.g.
010011000
- First char is acc value
- Rest is program