There are libraries that let you generate minecraft structure files programmatically [0]. These can then be pasted into the world.
You still need to come up with the circuitry for all the maths and figure out how to represent all the state with red stone, but once you get the little bits done itβs quite a quick process filling in weights and duplicating logic sections