1. A computer-implemented method for providing secure, multi-party computation, the method being executed using one or more processors and comprising: receiving, by the one or more processors, a program, the program being human-readable and comprising one or more expressions to provide secure computation based on inputs provided by two or more parties, the program providing a secure computation protocol comprising at least one calculation that is performed on behalf of the two or more parties; processing, by the one or more processors, the program and one or more rewriting rules in view of a cost-driven heuristic to automatically generate a rewritten program, the rewritten program including a structure that enables localization of one or more calculations and providing an optimized secure computation protocol that localizes the at least one calculation to be performed by at least one of the two or more parties; and compiling, by the one or more processors, the rewritten program to generate a computer-executable program.