8. A system for staged compilation of a declarative program comprising: a declarative language compiler configured to receive a declarative program as input, and comprising: a parse and semantic check module configured to parse and semantically check the declarative program; a graph generation module configured to compute a strongly connected component graph; a relational algebra machine (RAM) generation module configured to translate 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; and a code generation module configured to: perform a translation of the RAM into code of an imperative programming language to obtain a translated RAM; generate specialized extractor code in the imperative programming language, wherein the specialized extractor code comprises a reduced set of relations extracted from the declarative program; generate query API code in the imperative programming language; compile the translated RAM, the specialized extractor code, and the query API code to obtain a program analysis module; receive a program for analysis; provide the program as input to the program analysis module; extract a plurality of input relations from the program; and perform, using the plurality of input relations, a static program analysis on the program.
11. The system of claim 8 , wherein use of the modified semi-naïve algorithm causes the RAM generation module to be configured to: perform a set of initial operations; execute, after performing the set of initial operations, a plurality of first unrolled loop iterations; make 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; add the first new knowledge to current knowledge to obtain first updated current knowledge; execute, after executing the plurality of first unrolled loop iterations, a plurality of second unrolled loop iterations; make 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; add the second new knowledge to the first updated current knowledge to obtain second updated current knowledge; re-execute 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 add, based on the third determination, relations of a component to a computed relations set.