1. A method for compiling data, the method comprising: receiving an input query in a first language; translating the input query to a nested relational algebra (NRA) in the form of a first intermediate representation (IR), wherein the first IR comprises a high-level functional language including algebraic operators; implementing a set of algorithms of the algebraic operators to compile at least some of the first IR into a second IR, wherein the second IR comprises a hybrid language which utilizes a data-flow language and a set of lower-level extensions, and wherein the second IR is optimized by utilizing a set of specific optimizations targeting a part of the second IR that was compiled from a set of algebraic operators of the first IR; and compiling at least one of: the first IR and the second IR, into a low-level code.