A Stack-Based Approach to Query Languages. Institute of Computer Science Polish Academy of Sciences, Report 738, Warszawa, Dec. 1993. We follow a new paradigm of programming languages in which imperative programming constructs and programming abstractions are built around a declarative query language. Seamless integration of queries with programming constructs implies a new approach to query languages, in which we employ the classical naming, scoping and binding issues. We define a simple abstract storage model, which makes possible to map modelling primitives of data models, including relational and object-oriented models.
Theta can be selection, projection, navigation, join, quantifier, sorting, transitive closure, etc.
Such operators are formally defined by an abstract machine, which iteratively evaluates q2 in new environments, which are determined by tuples returned by q1. The approach supports complex objects, object identities, null-values and variants. Query operators can be seamlessly integrated with imperative constructs such as updating, for each, etc. Finally, a new optimization method based on the proposed approach is presented.