Legal documents are already a combination of data values and custom rules, they just also reference external rule sets such as legislation, regulation or case law. I work at a company where we use the same data points to generate the legal documents for a funding round as well as the cap table before and after the round is closed. Term sheets are just a very verbose data file lol.
Imagine a legal document that is written using terminology that is ultimately just a series of higher-order functions. A human could make sense of it with some training, and a computer could directly execute it with determinism.