0000000000006383

AUTHOR

Seppo Sippu

A generalized transitive closure for relational queries

We augment relational algebra with a generalized transitive closure operator that allows for the efficient evaluation of a subclass of recursive queries. The operator is based on a composition operator which is as general as possible when the operator is required to be associative and when only relational algebra operators are used in its definition. The closure of such a composition can be computed using the well-known efficient algorithms designed for the computation of the usual transitive closure. Besides the case in which complete materialization of recursive relations are required, our strategy also yields an efficient solution in the case in which a selection is applied to the closur…

research product

Algorithms on Graphs

In this chapter we shall develop some basic algorithms for directed graphs and relations which will be of use in later chapters, where the efficient construction of parsers is considered. The constructions needed can be expressed as the computing of certain “relational expressions”. These are expressions whose operands are relations and whose operators are chosen from among multiplication, closure, union and inverse. For this purpose we need to develop an algorithm for computing the closure of a relation. In view of the nature of our applications, the most appropriate way to do this is by a depth-first traversal of the graph that corresponds to the given relation. Other ways of computing th…

research product

Efficient evaluation for a subset of recursive queries

Abstract We consider the efficient evaluation of recursive queries in logic databases where the queries are expressed using a Datalog program (function-free Horn-clause program) that contains only regularly or linearly recursive predicates. Using well-known results on graph traversal, we develop an efficient algorithm for evaluating relations defined by a binary-chain program. We also present a transformation by which the evaluation of a subset of queries involving nonbinary relations can be reduced to the evaluation of binary-chain queries. This transformation is guided by the choice of bound arguments in the query, and the bindings are propagated through the program so that in the evaluat…

research product

Syntax Error Handling

In the previous chapters we have seen that the various parsers discussed, at least whenever they are deterministic, detect an error in any nonsentence. This means, that on any nonsentence there is a computation ending with an error configuration. For practical parsers, mere error detection is not enough; the parser should also emit a meaningful error message and recover from the error. A recovery means that the error configuration is transformed into a non-error configuration at which normal parsing can be resumed. Moreover, the transformation should be done so that as few input symbols as possible will be discarded. The goal of the error recovery is to maximize the amount of input text tha…

research product

Multiple SIP strategies and bottom-up adorning in logic query optimization

Preprocessing methods called “readorning” and “bottom-up adorning” are introduced as means of enlarging the application domain of magic sets and related query optimization strategies for logic databases. Readorning tries to make possible the simultaneous use of multiple sideways information passing (sip) strategies defined for a rule, thus yielding an optimization effect that may not be achieved by any particular choice of sip strategies. Bottom-up adorning is used to make magic sets applicable to cases in which potential optimizations can be derived from bindings coming upwards from rule bodies to rule heads in bottom-up evaluation. These include the cases in which we know that some base r…

research product

Elements of Language Theory

In this chapter we shall review the mathematical and computer science background on which the presentation in this book is based. We shall discuss the elements of discrete mathematics and formal language theory, emphasizing those issues that are of importance from the point of view of context-free parsing. We shall devote a considerable part of this chapter to matters such as random access machines and computational complexity. These will be relevant later when we derive efficient algorithms for parsing theoretic problems or prove lower bounds for the complexity of these problems. In this chapter we shall also discuss a general class of formal language descriptors called “rewriting systems”…

research product

Context-free Languages

In this chapter we shall define a class of rewriting systems called context-free grammars. The left-hand side of a rule in a context-free grammar consists of a single symbol, so that symbols are rewritten “context-freely”. Context-free grammars are of central importance to us because they define the class of context-free languages, the parsing of which is the subject of this book. In this chapter we shall consider some structural properties of context-free grammars which are of importance in parsing. Also, a basic method for recognizing context-free languages will be given.

research product

On the use of relational expressions in the design of efficient algorithms

Relational expressions have finite binary relations as arguments and the operations are composition (·), closure (*), inverse (−1), and union (U). The efficient computation of the relation denoted by a relational expression is considered, and a tight bound is established on the complexity of the algorithm suggested by Hunt, Szymanski and Ullman. The result implies a unified method for deriving efficient algorithms for many problems in parsing. For example, optimal algorithms are derived for strong LL(1) and strong LL(2) parser construction and an efficient polynomialtime algorithm is derived for determining the inessential error entries in an LR(1) parsing table.

research product

LR(k) Parsing

In this chapter we shall generalize the notion of strong LL(k) parsing presented in Chapter 5 and consider a method for deterministic left parsing that applies to a slightly wider class of context-free grammars than does the strong LL(k) parsing method. This method will be called “canonical LL(k) parsing”. As in strong LL(k) parsing, the acronym “LL(k)” means that the input string is parsed (1) in a single Left-to-right scan, (2) producing a Left parse, and (3) using lookahead of length k.

research product

Testing Grammars for Parsability

In the preceding chapters we have studied in detail the major methods of deterministic context-free parsing: strong LL(k) parsing (Chapter 5), simple precedence parsing (Chapter 5), canonical LR(k) parsing, LALR(k) parsing, and SLR(k) parsing (Chapters 6 and 7), and canonical LL(k) parsing (Chapter 8). Each of these methods induces a class of grammars that are “parsable” using that method, that is, a class of grammars for which a deterministic parser employing that method can be constructed. For example, the LL(k) grammars constitute the class of grammars parsable by the LL(k) parsing method. By definition, a context-free grammar is an LL(k) grammar if and only if its canonical LL(k) parser…

research product

Construction and Implementation of LR(1) Parsers

This chapter is devoted to the practical issues involved in the construction and use of deterministic LR(1) parsers. We shall show how the practical versions of LR (1) parsers, most notably the LALR (1) parsers, can be constructed efficiently, and we shall present methods for encoding LR(1) parsers as efficient RAM programs. Two versions of RAM program implementation are considered: in the first implementation the parsing program is table-driven, that is, the rules of the parser are encoded in a two-dimensional array which is simulated by a program body; in the other implementation the tabular information is further transformed into a set of program statements.

research product