Compiler and simulator for digital logic