I mean, people have tried! Ethereum created a system of contracts implemented as a programming language. Know what it led to? People losing huge amounts of their money after someone found a bug in the contract and exploited it. And after that, the money was gone. The hacker had followed the contract as written, and the money was theirs now.
Ultimately, the only ways that situation doesn't play out is if the system is designed perfectly not just for current use but all future uses, or Humans are removed entirely from the equation. Since the former is impossible, and the latter means the system is either irrelevant or we're all dead and gone, we might as well accept Human intervention as inevitable.
Above all, if the law would be code, who would decide the input? Unless every conversation and record is already in the Law-Bots huge power is given to the "formatting" of the evidences.