This is cool stuff! i noticed the program class has both script pointer & stack state in it. i need to dig thru how the stack(s) is affected by interpreter step by step... I couldn't figure out previously, why the input script is evaluated separately from the output script, even though the input script end-state is carried over to the output script program ...
https://github.com/libbitcoin/libbitcoin/blob/master/src/chain/script.cpp#L1387-L1395