15. The non-transitory computer readable medium of claim 12 , wherein translating the declarative program into the RAM using the modified semi-naïve algorithm comprises: performing a set of initial operations; executing, after performing the set of initial operations, a plurality of first unrolled loop iterations; making a first determination, after executing the plurality of first unrolled loop iterations, that first new knowledge was found during execution of the plurality of first unrolled loop iterations; adding the first new knowledge to current knowledge to obtain first updated current knowledge; executing, after executing the plurality of first unrolled loop iterations, a plurality of second unrolled loop iterations; making a second determination, after executing the plurality of second unrolled loop iterations, that second new knowledge was found during execution of the plurality of second unrolled loop iterations; adding the second new knowledge to the first updated current knowledge to obtain second updated current knowledge; re-executing the plurality of first unrolled loop iterations and the plurality of second unrolled loop iterations until a third determination is made that no new knowledge is found after execution of one selected from a group consisting of the plurality first unrolled loop iterations and the plurality of second unrolled loop iterations; and adding, based on the third determination, relations of a component to a computed relations set.
12. A non-transitory computer readable medium comprising instructions that, when executed by a computer processor, perform a method for staged compilation of a declarative program comprising: receiving the declarative program; parsing and semantically checking the declarative program; translating the declarative program into a relational algebra machine (RAM) using a modified semi-naïve algorithm, wherein the modified semi-naïve algorithm is a semi-naïve algorithm with modifications comprising unrolling two iterations of a fixed-point loop; performing a translation of the RAM into code of an imperative programming language to obtain a translated RAM; generating specialized extractor code in the imperative programming language, wherein the specialized extractor code comprises a reduced set of relations extracted from the declarative program; generating query API code in the imperative programming language; compiling the translated RAM, the specialized extractor code, and the query API code to obtain a program analysis module; receiving a program for analysis; providing the program as input to the program analysis module; extracting a plurality of input relations from the program; and performing, using the plurality of input relations, a static program analysis on the program.