Π( ) Π( ) Π( ) A ε. b b. (d) (c) (a) (b)

Size: px
Start display at page:

Download "Π( ) Π( ) Π( ) A ε. b b. (d) (c) (a) (b)"

Transcription

1 Top-Down Parsing of Conjunctive Languages Alexander Okhotin Faculty of Computational Mathematics and Cyernetics, Moscow State University Astract. This paper generalizes the notion of a strong LL(k) context-free grammar for the case of conjunctive grammars and develops a top-down parsing algorithm for the resulting language family. A top-down parser of a conjunctive language attempts to construct a derivation of the input string, at each step using a nite lookahead to determine which grammar rule to apply. Fragments of formulae that form the derivation are stored in a treestructured pushdown. Two ways to implement top-down parsers are suggested: a tale-driven parser with a tree-structured pushdown and a recursive descent parser. Both techniques naturally extend their context-free counterparts. Keywords: Conjunctive grammar, parsing, top-down, tree-structured pushdown, recursive descent 1. Introduction Conjunctive grammars, introduced in [6, 7], generalize the contextfree grammars y augmenting the formalism of grammar rules with an explicit set-theoretic intersection operation. The importance of intersection for applications (in particular, linguistic applications) has long een noted, since languages are often dened using a set of independent constraints, which essentially means conjunction. Additionally, several non-context-free language constructs common to natural languages, such as multiple agreements and crossed agreements, are known to e representale as nite intersections of context-free languages. This provided motivation for the study of the intersection closure of context-free languages [3], with the intention to use tuples of context-free grammars to denote intersection of languages generated y these grammars, i.e. allow the use of intersection `on the top' of the classical context-free grammars. Conjunctive grammars use an entirely grammatical approach of handling intersection, where an extra intersection operation is added to the traditional union and concatenation, and no restriction is imposed on the use of this operation. The class of conjunctive grammars gives a certain increase in descriptive power over the context-free grammars, Present address: Department of Computing and Information Science, Queen's University, Kingston, Ontario, Canada K7L 3N6. c 2001 Kluwer Academic Pulishers. Printed in the Netherlands. top-down.tex; 14/10/2001; 21:09; p.1

2 2 Alexander Okhotin eing capale oth of denoting non-context-free language constructs (including those not in the intersection closure of context-free languages, e.g. the classical non-context-free language fwcwjw 2 fa; g g) and providing very succinct descriptions of some context-free languages. In addition, conjunctive grammars inherit several attractive properties of context-free grammars, such as the representation of a derivation in the form of a tree and the existence of ecient parsing algorithms. A way to construct a cuic-time and quadratic-space recognizer for an aritrary conjunctive language was given in [7]; this algorithm is a natural generalization of the classical context-free Cocke{Hasami{ Younger algorithm, as descried in [2]. Despite its polynomiality, the algorithm from [7] is still not very useful for many potential practical applications, where a less general ut faster algorithm would e more appealing. In addition, the requirement for a grammar to e in the inary normal form is also a very inconvenient constrain. There exist numerous linear-time parsing algorithms for various suclasses of the context-free grammars; the LL(k) [1, 4] and LR(k) [1, 2] algorithms and some of their variations are the most widely used among them. It turns out that the SLL(k) (strong LL(k)) context-free parsing method can e eectively extended for the case of conjunctive grammars. The construction and explanation of the resulting algorithm is the main concern of this paper. Section 2 gives a asic overview of the conjunctive grammars; in addition to the material taken from [6, 7], a network representation of the conjunctive formulae is introduced, which is used extensively in the rest of the paper. In Section 3, we consider a kind of nondeterministic context-free top-down parser and generalize it for the conjunctive case, giving a denition of the conjunctive top-down parser with a treestructured pushdown. The latter turns out to e deterministic for a certain suclass of conjunctive grammars we name conjunctive SLL(k) (&SLL(k) for short). It is proved that the exact parsing tale for such a parser cannot e algorithmically computed, and Section 4 develops a way to compute a certain `approximation' of this parsing tale, which could e used for a reasonaly large suclass of the conjunctive SLL(k) grammars. Section 5 suggests two dierent methods to implement conjunctive top-down parsing and investigates their complexity. 2. Preliminaries A conjunctive grammar [7] is dened similarly to a context-free grammar, with the only dierence that its rules may consist of multiple conjuncts. top-down.tex; 14/10/2001; 21:09; p.2

3 Top-Down Parsing of Conjunctive Languages 3 DEFINITION 1. A conjunctive grammar is a quadruple G = (; N; P; S), where and N are disjoint nite nonempty sets of terminal and nonterminal symols respectively; P is a nite set of grammar rules, each of the form A! 1 & : : : & n (A 2 N; n > 1; 8i i 2 ( [ N) ); (1) where the strings i are called conjuncts and, as we shall shortly see, there is no loss of generality in the assumption that they are distinct and their order is insignicant; S 2 N is a nonterminal designated as the start symol. Let V e the union of and N. We shall use three special symols: \(", \&" and \)"; it is assumed that none of them is in V. Dene V = [ N [ f\(", '&", ')"g. Let us also dene the set conjuncts(g) = fa! j there is a rule A! 1 & : : : & n 2 P; such that i = for some i (1 6 i 6 n)g (2) According to the semantics of the conjunctive grammars, which is dened elow, a rule of the form (1) indicates that the nonterminal on the left can derive any terminal string that can e derived from each of the conjuncts on the right. Similarly to a context-free grammar, a conjunctive grammar generates strings y the means of nondeterministic transformation of sentential forms, starting from the start symol and ending with a string comprised of terminal symols. However, the ojects eing transformed in course of such a derivation are more complex than in the context-free case: DEFINITION 2. Let G = (; N; P; S) e a conjunctive grammar. The set of conjunctive formulae F is the least suset of V that satises the following conditions: 1. [ N F F. 3. If A; B 2 F (where A 6=, B 6= ), then AB 2 F. 4. If A 1 ; : : : ; A n 2 F (where n > 1; A i may e ), then (A 1 & : : : &A n ) 2 F. In order to make the notation more clear, the empty sustrings appearing in accordance with (ii) will e written out explicitly, i.e. we shall write (A()&) rather than (A()&). top-down.tex; 14/10/2001; 21:09; p.3

4 4 Alexander Okhotin Conjunctive formulae can e naturally represented in the form of ipolar serial-parallel networks (-networks), dened inductively over the structure of a formula, where symols from [ N and the mentioned empty strings form individual arcs laeled with s 2 [ N [ fg, concatenation is represented y serial composition and conjunction is represented y parallel composition, as illustrated in Figure 1. s (a) ε () Π( ) Π( ) (c) (d) Γ( Π( ) ) Π( ) Figure 1. -networks corresponding to (a) s 2 [ N () (c) AB (d) (A 1& : : : &A n). Note that for every formula A there is exactly one corresponding -network (we shall denote it (A)), ut for every -network there are innitely many corresponding formulae (consider A, (A), ((A)), : : :, which all correspond to the same -network). With each path in a -network we shall associate a string over V formed y the laels on the arcs that constitute the path (where -arcs function as identity); paths connecting the poles shall e sometimes called just paths. See Figure 2 for an example of a -network corresponding to a formula. a c c c A c A ε d d d ε Figure 2. -network corresponding to a((c&(c&c)a)(a&)d&()c(d&d))(()). DEFINITION 3. Let G = (; N; P; S) e a conjunctive grammar. De- ne =), G the relation of one-step derivaility on the set of conjunctive formulae. 1. For any s 0 ; s 00 2 V and A 2 N, such that s 0 As 00 2 F, and for all A! 1 & : : : & n 2 P, s 0 As 00 G =) s 0 ( 1 & : : : & n )s 00 (3) top-down.tex; 14/10/2001; 21:09; p.4

5 Top-Down Parsing of Conjunctive Languages 5 2. (The Gluing Rule) For any s 0 ; s 00 2 V and w 2, such that s 0 (w& : : : &w)s 00 2 F (where the numer of ws is greater than zero), G s 0 (w& : : : &w)s 00 =) G s 0 ws 00 (4) {z } n>1 Let =) denote the reexive and transitive closure of e the relation of derivaility in exactly n steps. G =).Let G =) (n) DEFINITION 4. Let G = (; N; P; S) e a conjunctive grammar. The language of a formula is the set of all terminal strings derivale from the formula: L G (A) = fw 2 j A =) G wg. The language generated y the grammar is the language generated y formula S: L(G) = L G (S). We quote the following key theorem from [7]: THEOREM 1. Let G = (; N; P; S) e a conjunctive grammar. Let A 1 ; : : : ; A n ; B e formulae, let A 2 N, let u 2. Then, L G ((A 1 & : : : &A n )) = n\ i=1 L G (AB) = L G (A) L G (B) L G (A i ) L G (A) = [ fl G (( 1 & : : : & m )) j A! 1 & : : : & m 2 P g L G (u) = fug (5a) (5) (5c) (5d) Since the emptiness of the intersection of two given context-free languages is undecidale, the undecidaility of the emptiness prolem for conjunctive languages is immediately estalished. Let us also consider a restricted form of derivation, the derivation with postponed gluing, which is organized in the following way: rst, rules from P are applied until there are no nonterminals left in the formula; after that, the gluing rule is applied until all parentheses and conjunction signs are removed. P Formally, let =) e the relation of derivaility in one step of applying a rule from P, and =) & e the relation of derivaility in one G step of applying the gluing rule (oviously, =) equals =) P [ =)). & The derivations with postponed gluing are derivations of the form A 0 P P =) A 1 =) : : : P =) A m = B 0 & =) B 1 & =) : : : & =) B n = w 2 (6) It is quite clear that derivation with postponed gluing is equivalent in power to the unrestricted derivation, i.e. A G =) w holds i 9B 2 F top-down.tex; 14/10/2001; 21:09; p.5

6 6 Alexander Okhotin such that A =) P B =) & w; this can e formally proved y a direct construction of the derivation with postponed gluing (6) from an aritrary given derivation from A 0 to w. EXAMPLE 1. Consider the following grammar for the classical noncontext-free language fa n n c n j n > 0g: S! AP & QC A! aa j P! P c j Q! aq j C! cc j Following is the derivation with postponed gluing of the string w = ac: S P =) : : : P =) ((a())(()c)&(a())(c())) & =) : : : & =) ac (7) Each conjunctive derivation can e represented in the form of a tree with shared leaves. This tree is constructed inductively y the length of the derivation. 1. The tree corresponding to S is a single node laeled with S. 2. For every application of a rule A! 1 & : : : & n 2 P to a sentential form, the corresponding leaf of the tree (which is laeled with A) is relaeled with A! 1 & : : : & n and supplied with descendants corresponding to all symols from all 1 ; : : : ; n in the same way as a context-free derivation tree is modied upon application of a rule A! 1 : : : n. 3. For every application of the gluing rule, the leaves corresponding to the sustrings eing glued are similarly glued. Thus, terminal leaves of the resulting tree can possily have more than one incoming arc. We shall use notation 6n to denote fu j u 2 ; juj 6 ng. DEFINITION 5. L. Dene Let k > 0. Let e a nite nonempty alphaet, let F irst k (L) = (L \ 6k ) [ fu j u 2 k ; 9v 2 + : uv 2 Lg (8) Since for every singleton language L = fwg, F irst k (L) is also a singleton, we shall adopt notation F irst k (w) for the only string in F irst k (fwg). top-down.tex; 14/10/2001; 21:09; p.6

7 Top-Down Parsing of Conjunctive Languages 7 3. Parser with a Tree-Structured Pushdown In this section we introduce the notion of a nondeterministic parser with a tree-structured pushdown, and show that it is equivalent to the conjunctive derivation (as in Denition 3) in the sense that such a parser has at least one accepting computation on some input string if and only if the string elongs to the language generated y the source grammar The Context-Free Case Let us review the nondeterministic context-free top-down parsing and its deterministic case applicale to strong LL(k) grammars. We shall dene the algorithm and the SLL(k) grammars in a somewhat complicated way, ecause that will sustantially simplify the transition to the conjunctive case. A context-free top-down parser constructs the leftmost derivation of the input string, using a pushdown (in this case it is a conventional linear pushdown) to store the right parts of the sentential forms forming the derivation. Left parts of sentential forms are prexes of the input string; they are not eing held in memory. Formally, the instantaneous description (id) of the parser is a pair (u; ) (u 2, 2 V ), where u is the unread portion of the input string and is the contents of the pushdown. The parser starts from id (w; S), where w is the input string and S is the start symol of the grammar. At each step of the computation one of the following is eing done: 1. Apply a rule. If there is a nonterminal A 2 N at the top of the pushdown, i.e. id = (u; A), then choose (nondeterministically) some rule A! 2 P and move to id (u; ). 2. Advance. If there is a terminal symol a 2 at the top of the pushdown and the unread portion of the string also egins with a, i.e. id = (av; a), then move to id (v; ). 3. Accept. If oth the input string and the pushdown have een exhausted, i.e. id = (; ), then accept the string. 4. Reject. If none of (i)-(iii) is the case, then reject the string. It is easily seen that every computation of the top-down parser follows some leftmost derivation S =) u 1 1 =) : : : =) u n?1 n?1 =) w (8i ju i j 6 ju i+1 j); (9) top-down.tex; 14/10/2001; 21:09; p.7

8 8 Alexander Okhotin where i are eing stored in the pushdown, while u i are eing discarded. Each application of rule y the parser corresponds to one step of (9); advancing along the input string represents internal data management, where symols are rearranged etween i and u i, and ensures that u i are prexes of w. The only source of nondeterminism is the choice of the rule to apply to a nonterminal. SLL(k) parsers use k rst symols of the unread portion of the input string (the lookahead string) in order to `predict' the correct rule; their ehaviour is dened y the following function. DEFINITION 6 (SLL(k) parsing tale). Let k > 0. Let G = (; N; P; S) e a context-free grammar. Dene T SLL(k), a mapping from N 6k to 2 P. A rule A! 2 P is in T SLL(k) (B; u) i A = B and there are strings x; y; z 2, such that 1. S G =) xyz. 2. There is a derivation tree of xyz that contains a node laeled with A; this node's direct descendants form the string. 3. This node is an ancestor of those and only those terminal leaves that correspond to the symols forming y; that implies A =) =) y. 4. F irst k (yz) = u. This derivation tree is shown in Figure 3(a). (a) () A A α & &α 1 n α α1 α n x y z x y Figure 3. Derivation trees: (a) Context-free case () Conjunctive case. z A context-free grammar is said to e SLL(k) if jt SLL(k) (A; u)j 6 1 for all A 2 N and u 2 6k, i.e. the choice of rule is always deterministic; top-down.tex; 14/10/2001; 21:09; p.8

9 Top-Down Parsing of Conjunctive Languages 9 there exists an algorithm to compute T SLL(k) for a given grammar and thus determine whether it is SLL(k) The Conjunctive Case We shall employ asically the same idea for the top-down parsing of conjunctive languages. When a multiple-conjunct rule A! 1 & : : : & n (n > 2) is eing applied, the parser should try to derive the same sustring of the input string from each of the conjuncts. This can e achieved y using a tree-structured pushdown to organize the sequential computation so that derivations from each i were carried out independently and in parallel. Every next symol of the input string can e shifted only if the top symols of all the ranches are equal to each other and to the input symol. This ensures the equality of strings eing derived from the conjuncts. The tree-structured pushdown T is a tree with edges laeled with symols from [ N and vertices which can either e marked or not marked. Edges incident to the leaves are the top edges of the pushdown; the top edges are considered ordered. Edges can e thought of as directed from the leaves down to the root, each pointing to its parent. A marked vertex can e thought of as a vertex connected to the top of the pushdown with an imaginary -edge, acting as a `promise' to derive the null string from all the remaining ranches meeting at that vertex. An instantaneous description (id) of a parser with a tree-structured pushdown is a pair (u; T ), where u is the unread portion of the input string and T is the tree-structured pushdown. The initial id is (w; T S ), where w is the input string and T S is a tree comprised of two unmarked vertices connected with an edge laeled with the start symol S. At each step of the computation, the parser does one of the following: 1. Apply a rule. If there are top edges laeled with nonterminals, then consider the leftmost among these edges. Let A 2 N e the nonterminal it is laeled with. Choose (nondeterministically) some rule A! 1 & : : : & n 2 P. If the rule does not contain an epsilon conjunct, i.e. it is of the form A! s 11 : : : s 1l1 & : : : &s n1 : : : s nln (8i l i > 0; 8j s ij 2 V ), then replace the edge with n ranches, as shown in Figure 4(a). If there is an epsilon conjunct, i.e. the rule is of the form A! s 11 : : : s 1l1 & : : : &s n?1;1 : : : s n?1;ln?1 & (n > 1, l i > 0, s ij 2 V ), then top-down.tex; 14/10/2001; 21:09; p.9

10 10 Alexander Okhotin A s 11 s n1 a a a a X X s 1l 1 snl n (a) () Figure 4. One computation step: (a) Apply a rule () Advance. a) If n = 1 (the rule is A! ) and the edge corresponding to A is the only incoming edge at the vertex where it goes, then unmark that vertex (this means that if the parser has earlier promised to derive empty strings from all the ranches meeting at that vertex, then this promise has now een fullled); ) If n > 1 or there are other incoming edges at that vertex, then mark the vertex (to state that all the remaining ranches meeting here should derive ); c) Replace the edge with n? 1 ranches corresponding to nonepsilon conjuncts (see again Figure 4(a)). 2. Advance. If there are no marked vertices in the pushdown, all top edges are laeled with the same terminal symol a 2, and the current input symol is also a (u = av, v 2 ), then do the following: a) Mark all vertices having oth top edges and non-top edges among their incoming edges. ) Remove all top edges and all leaves. c) Assign u := v. This case is illustrated in Figure 4(). The requirement that there should e no marked vertices in the pushdown ensures that nothing ut could e derived from the ranches meeting at marked vertices, ecause the empty string is the only string that can e derived without reading the input. 3. Accept. If oth the input string and the tree-structured pushdown have een exhausted (i.e. the unread portion of the string is and the tree consists of the root vertex), then accept the string. 4. Reject. If none of (i)-(iii) is the case, then reject the string. top-down.tex; 14/10/2001; 21:09; p.10

11 Top-Down Parsing of Conjunctive Languages 11 For each conjunctive grammar G = (; N; P; S) and for each w 2 the corresponding parser with a tree-structured pushdown has an accepting computation on w i w 2 L(G). The following explanation of parser operation also serves as a sketch of the proof. First, we shall use the fact that for any formula s 1 As 2 and for any rule A! 1 & : : : & n 2 P, the network (s 1 ( 1 & : : : & n )s 2 ) can e constructed y replacing the arc corresponding to A in (s 1 As 2 ) y a sugraph (( 1 & : : : & n )). That means that the rst part of the derivation with postponed gluing can e performed on -networks. Second, we note that a formula containing no nonterminal symols generates either the empty language or a single string. This language can e determined y processing (B) from left to right and checking all paths connecting the poles of the network for equality. Thus we see that the second part of the derivation with postponed gluing can also e done y analyzing the -network that was constructed in course of the rst part of the derivation. Then, we oserve that it is possile to do network rewriting (which corresponds to the rst part of the derivation with postponed gluing) at the same time as checking whether the resulting formula will generate exactly the input string (this corresponds to the second part of the derivation with postponed gluing). The network is processed from left to right; all nonterminals encountered are replaced with sugraphs corresponding to rule odies; terminals are passed through in all paths at the same time, provided they all are equal to each other; -arcs are passed through whenever they are encountered. Finally, we note that there is no need to store the left (processed) part of the -network, ecause it is no longer used. It can also e proved that, since we always apply rules to the leftmost nonterminals, the right part of the network will always e a tree with shared leaves. The information aout leaf sharing is not used and therefore may e disregarded. ε ε ε a a ε E A B A B E Figure 5. A splitted -network and its right part as a tree-structured pushdown. We conclude that it suces to store the tree-structured pushdown, which is essentially the right part of the network, as shown in the example in Figure 5. top-down.tex; 14/10/2001; 21:09; p.11

12 12 Alexander Okhotin It can e oserved that the only source of nondeterminism in the topdown parsing is the choice of rule to apply to a nonterminal. In the same way as in the context-free prototype of our parser, we introduce the parsing tale that limits and possily eliminates this nondeterminism using a nite lookahead in the input string. DEFINITION 7 (Conjunctive SLL(k) parsing tale). Let k > 0. Let G = (; N; P; S) e a conjunctive grammar. Dene T &SLL(k), a mapping from N 6k to 2 P. A rule A! 1 & : : : & n 2 P is in T &SLL(k) (B; u) i A = B and there are strings x; y; z 2, such that 1. S G =) xyz. 2. There is a derivation tree of xyz that contains a node laeled with A! 1 & : : : & n. 3. This node is an ancestor of those and only those terminal leaves that correspond to the symols forming y; that implies A =) G ( 1 & : : : & n ) =) G y. 4. F irst k (yz) = u. This case is illustrated in Figure 3(). A conjunctive grammar is said to e strong conjunctive LL(k) (&SLL(k) for short) if for every A 2 N and u 2 6k it holds that jt &SLL(k) (A; u)j 6 1, i.e. the choice of rule is always deterministic. However, the undecidaility of the emptiness prolem for the conjunctive languages [7] easily implies the following result: LEMMA 1. For any k > 0 the tale T &SLL(k) is not computale. It is undecidale whether a given conjunctive grammar is &SLL(k). 4. Computation of Parsing Tales In this section we shall develop a practical method of parsing tale construction for conjunctive top-down parsers. The main idea is to compute some reasonale extension of T &SLL(k), i.e. a function T k : N 6k! 2 P such that for all A 2 N and u 2 6k it would hold that T &SLL(k) (A; u) T k (A; u); (10) top-down.tex; 14/10/2001; 21:09; p.12

13 Top-Down Parsing of Conjunctive Languages 13 and (10) would turn to equality for a suciently large class of grammars. We shall now dene the conjunctive analogs of the First k and Follow k functions; see [1] for the corresponding denitions for the context-free case. DEFINITION 8. Let k > 0. Let G = (; N; P; S) e a conjunctive grammar. Dene First k, a mapping from the set of conjunctive formulae to 6k : First k (A) = F irst k (L G (A)) (11) DEFINITION 9. Let k > 0.Let G = (; N; P; S) e a conjunctive grammar. Dene Follow k, a mapping from N to 6k. A string u 2 6k is in Follow k (A) i there exist strings x; y; z 2, such that 1. S G =) xyz. 2. There is a derivation tree of xyz (see again Figure 3()) that contains a node laeled with some rule A! 1 & : : : & n 2 P. 3. This node is an ancestor of those and only those terminal leaves that correspond to symols forming y. 4. F irst k (z) = u. Both First k and Follow k are clearly incomputale (since First k (S) = ; i First k (S) = ; i L(G) = ;). Again, we shall try to construct some reasonale extensions of these functions. The functions Pfirst k and Pfollow k (which stand for potential First and Follow) dene the terminal strings which either (Pfirst) start all paths in the -network of some formula derived from a given formula, or (Pfollow) follow a given nonterminal in all paths in the -network of some formula derived from S. Memership in Pfirst and Pfollow is estalished on the asis of incomplete derivations; these derivations do not necessarily have continuations leading to terminal strings, ut if they have, then the strings thus proved to e in Pfirst (Pfollow) will e in First (Follow). Pfirst and Pfollow are formally dened y the following algorithms which simulate such incomplete derivations. top-down.tex; 14/10/2001; 21:09; p.13

14 14 Alexander Okhotin DEFINITION 10. Let G = (; N; P; S) e a grammar, let k > 0. Pfirst k is a mapping from F to 6k, dened as follows: Pfirst k (w) = F irst k (fwg) (w 2 ) (12a) Pfirst k (AB) = F irst k (Pfirst k (A) Pfirst k (B)) (A; B 2 F) (12) Pfirst k ((A 1 & : : : &A n )) = n\ i=1 Pfirst k (A i ) (n > 0; A i 2 F) (12c) Pfirst k (A) = (as computed y Algorithm 1) (A 2 N) (12d) ALGORITHM 1. For given G and k > 0 compute Pfirst k (A) for all A 2 N. let Pfirst k (A) = ; for all A 2 N; while new strings can e added to Pfirst k (A) for 8A! s 11 : : : s 1n1 & : : : &s m1 : : : s mnm 2 P Pfirst k (A) = Pfirst k (A) [ [ T m i=1 F irst k (Pfirst k (s i1 ) : : : Pfirst k (s ini )); The function Pfollow k algorithm: : N! 6k is dened y the following ALGORITHM 2. For given G and k > 0 compute Pfollow k (A) for all A 2 N. let Pfollow k (S) = fg; let Pfollow k (A) = ; for all A 2 N n fsg; while new strings can e added to Pfollow k (A) for 8B! 2 conjuncts(p ) for each factorization = A, where ; 2 V and A 2 N Pfollow k (A) = Pfollow k (A) [ [ F irst k (Pfirst k () Pfollow k (B)); The following two lemmas show that Pfirst k extend First k and Follow k respectively. and Pfollow k LEMMA 2. For any grammar G = (; N; P; S) and for any formula A 2 F, First k (A) Pfirst k (A). Proof. It suces to prove that for any A 2 N, w 2 and n > 0, such that A =) G (n) w, it holds that F irst k (w) 2 Pfirst k (A). The proof in an induction on n. Basis n = 2. There is a rule A! w 2 P and the derivation is of the form A =) (w) =) w. Clearly, F irst k (w) is added to Pfirst k (A) at the rst iteration of Algorithm 1. top-down.tex; 14/10/2001; 21:09; p.14

15 Top-Down Parsing of Conjunctive Languages 15 Induction Step. Let A =) (n+2) w, then for some rule A! s 11 : : : s 1p1 & : : : &s m1 : : : s mpm 2 P (where s ij 2 V, p i > 0) A =) (s 11 : : : s 1p1 & : : : &s m1 : : : s mpm ) =) : : : =) =) (u 11 : : : u 1p1 & : : : &u m1 : : : u mpm ) =) w u 11 : : : u 1p1 = : : : = u m1 : : : u mpm = w (13a) (13) s ij =) (l ij ) u ij (8i 2 [1; m] 8j 2 [1; p i ]) (13c) X i;j l ij = n (13d) Consider some i: 1 6 i 6 m. For each j (1 6 j 6 p i ), the statement F irst k (u ij ) 2 Pfirst k (s ij ) (14) follows from the induction hypothesis if s ij Denition 10 if s ij 2. By concatenating (14) for all 1 6 j 6 p i, we otain 2 N and directly from F irst k (u i1 ) : : : F irst k (u ipi ) 2 Pfirst k (s i1 ) : : : Pfirst k (s ipi ) (15) and hence F irst k (w) 2 F irst k (Pfirst k (s i1 ): : :Pfirst k (s ipi )), which implies that F irst k (w) is added to Pfirst k (A) at some iteration of Algorithm 1. For the case of A =2 N, the proof easily follows from Theorem 1 and Denition 10 and is omitted. 2 LEMMA 3. For any grammar G = (; N; P; S) and for any nonterminal A 2 N, Follow k (A) Pfollow k (A). Proof. Let A 2 N and u 2 Follow k (A), then there exist x; y; z 2 that satisfy the conditions listed in Denition 9. Let S = A 0 =) G A G 1 =) : : : G =) A G m =) : : : G =) A n = xyz (16) e the derivation from Denition 9, where A m is the formula where the instance of A mentioned in denition Denition 9 appears for the rst time.our proof is an induction on m. Basis m = 0. Then A = S, z = and thus u =. is added to Pfollow k (S) y the rst statement of Algorithm 2. Induction Step. Let m > 0. Then there exist some B 2 N; B! 1 & : : : & p 2 P ; s 1 ; s 2 2 V ; ; 2 V and i 2 [1; p], such that A m?1 = s 1 Bs 2 A m = s 1 ( 1 & : : : & p )s 2 i = A; (17a) (17) (17c) top-down.tex; 14/10/2001; 21:09; p.15

16 16 Alexander Okhotin where the A in (17c) is the A from Denition 9. Let us change the order of steps in derivation (16), so that the derivation from would e carried out rst. This is possile, ecause the derivation (16) is known to e successful. We get G s 1 ( 1 & : : : &A& : : : & p )s 2 =) s 1 ( 1 & : : : &Az 0 & : : : & p )s 2 (18) for some z 0 2. It can e proved that this implies z = z 0 z 00 for some z By the denition of First, F irst k (z 0 ) 2 First k (); therefore, y Lemma 2, F irst k (z 0 ) 2 Pfirst k (). By the denition of Follow, F irst k (z 00 ) 2 Follow k (B) due to the factorization w = x yz 0 z 00 and the same derivation (16). Since B rst appears at the step m?1 of the derivation, y the induction hypothesis we otain F irst k (z 00 ) 2 Pfollow k (B). We conclude that u 2 F irst k (Pfirst k () Pfollow k (B)), which implies that u is added to Pfollow k (A) at some iteration of Algorithm 2. 2 Let us now consider a parsing tale computed from some functions f and g serving as First and Follow: DEFINITION 11. Let k > 0. Let G e a conjunctive grammar. Let f : F! 6k. Let g : N! 6k. Dene T k;f;g, a mapping from N 6k to 2 P. A rule A! 1 & : : : & n is in T k;f;g (B; u) i A = B and u 2 F irst k (f(( 1 & : : : & n )) g(a)) (19) Lemmas 2 and 3 allow us to estalish the following result, which justies the use of Pfirst k and Pfollow k for the computation of the parsing tales: THEOREM 2. For any conjunctive grammar G = (; N; P; S) and k > 0, T k;pfirst k;pfollowk is a consistent top-down parsing tale, i.e. for all A 2 N and u 2 6n T &SLL(k) (A; u) T k;pfirst (A; u) (20) k;pfollowk Proof. Consider a nonterminal A 2 N, a lookahead string u 2 6k and a rule A! 1 & : : : & m 2 P, such that A! 1 & : : : & m 2 T &SLL(k) (A; u). Let x; y; z 2 e the strings mentioned in Denition 7. Since ( 1 & : : : & m ) =) y, we get that F irst k (y) 2 First k (( 1 & : : : & m )) and thus, y Lemma 2, F irst k (y) 2 Pfirst k (( 1 & : : : & m )) (21) top-down.tex; 14/10/2001; 21:09; p.16

17 Top-Down Parsing of Conjunctive Languages 17 On the other hand, the derivation tree under consideration satises Denition 9. We have F irst k (z) 2 Follow(A) and, y Lemma 3, We concatenate (21) and (22) to get F irst k (z) 2 Pfollow k (A) (22) u 2 F irst k (Pfirst k (( 1 & : : : & m )) Pfollow k (A)); (23) which proves the theorem. 2 EXAMPLE 2. Consider the grammar for L=fa n n c n j n > 0g from Example 1. Its Pfirst 1, Pfollow 1 and the corresponding parsing tale are shown in Tale I; it follows that the grammar is &SLL(1). Tale I. Pfirst 1, Pfollow 1 and T 1;Pfirst1 ;Pfollow1 for grammar from Example 1. T 1;Pfirst1 ;Pfollow1 Pfirst 1 Pfollow 1 a c S f; ag fg S! AP &QC S! AP &QC?? A f; ag f; g A! A! aa A!? P f; g f; cg P!? P! P c P! Q f; ag f; ; cg Q! Q! aq Q! Q! C f; cg fg C!?? C! cc The computation of the top-down parser for this grammar on the input string w = ac is shown in Figure 6. S A P Q C a Q a a A A Q P C P C A P Q C P Q C P c Q C P c C P c C c C c c C C Acc. Figure 6. Example of parsing This example shows that the &SLL(k) grammars can denote some non-context-free languages and thus have greater expressive power than the context-free LL(k) grammars. top-down.tex; 14/10/2001; 21:09; p.17

18 18 Alexander Okhotin Actually, a more general result concerning the scope of &SLL(k) languages can easily e estalished: THEOREM 3. For any k > 0, the family of &SLL(k) languages properly contains all context-free LL(k) languages and is closed under intersection. Let us also note that for each n > 1 there are &SLL(1) languages that cannot e expressed as an intersection of n? 1 context-free languages; that is, for instance, the language L n = fa i 1 1 ai 2 2 : : : ain n ai 1 1 ai 2 2 : : : ain n j 8j i j > 0g; (24) over the alphaet fa 1 ; : : : ; a n g, studied in [5]. Since it is an intersection of n context-free LL(1) languages, it is &SLL(1) y Theorem 3. Therefore, the family of &SLL(1) languages coincides with each sufamily of the innite hierarchy of intersections of context-free languages studied in [5]. It remains an open prolem whether &SLL(k) grammars can generate any conjunctive language, or at least if there exists any &SLL(k) language not in the intersection closure of context-free languages. 5. Implementation The model top-down parser with a tree-structured pushdown, introduced in Section 3, can e implemented in such a way that the numer of machine operations will e proportional to the numer of high-level operations. Each vertex of the tree-structured pushdown could e represented as a quadruple (s; p; n; ), where s 2 [ N is the symol on the arc leading down, p is the pointer to the destination vertex of that arc (for the root, p equals null and s is undened), n is the numer of incoming arcs, and 2 ftrue; falseg indicates whether this vertex is marked. In addition, we should hold the list of top arcs, each represented as a pair (s; p) (s 2 [ N; p is a pointer to some vertex), the pointer to the top arc eing processed and the counter of marked vertices. At each step of computation, the parser does not need to rowse the whole tree-structured pushdown: it suces to oserve the current top arc in the list and either (if it is a nonterminal arc) replace it with the ody of some rule, or (if it is a terminal arc, the terminal equals the current input symol and there are no marked vertices) proceed to the next top arc. When the end of the list is reached, it is already known that all top arcs are equal to the input symol and thus can e removed along with reading the next input symol. top-down.tex; 14/10/2001; 21:09; p.18

19 Top-Down Parsing of Conjunctive Languages 19 We see that each step of the computation (which corresponds to one step of the derivation) requires constant time, with the exception of the removal of the top arcs, which, however, cannot take more time than the application of the grammar rules, ecause every top arc requires an elementary operation to appear. Therefore, the complexity of the algorithm linearly depends on the length of the derivation. We shall also consider an alternative approach to the conjunctive top-down parsing, the recursive descent. This technique, which is frequently used for the top-down parsing of context-free languages, can e straightforwardly extended for the conjunctive case. Let G = (; N; P; S) e an &SLL(k) grammar, let k > 0, let T k : N 6k! 2 P e some function such that T &SLL(k) (A; u) T k (A; u) for all A 2 N and for all u 2 6k. For every terminal symol a 2 dene a procedure a(int &pointer) /* pointer is passed y reference */ f if(w[pointer]==a) pointer++; else reject(); g For every nonterminal symol A 2 N dene a procedure A(int &pointer) /* pointer is passed y reference */ f switch(t k (A; w + pointer)) f case A! s 11 : : : s 1l1 & : : : &s m1 : : : s mlm : int p[1::m]=f pointer, : : :, pointer g; for i = 1 to m /* may e executed in parallel */ for j = 1 to l i s ij (p[i]); if(not (8i; j p[i] == p[j])) reject(); pointer = p[1]; reak; case A! : : : :. default: /* if T k (A; w + pointer) is empty */ reject(); g g top-down.tex; 14/10/2001; 21:09; p.19

20 20 Alexander Okhotin Since the iterations of the outer loops in A() (A 2 N) are data-independent, these loops may e executed in parallel, i.e. their iterations may e distriuted etween processors of a multiprocessor system to speed up the algorithm. Exactly like in the context-free case, this algorithm could e modied to construct the derivation tree of the string, if each procedure creates its sutree and returns it to its caller. This parser is deterministic i jt k (A; u)j 6 1 for all A 2 N and u 2 6k. Its correctness is stated in the following theorem: THEOREM 4. For each grammar G and string w, w 2 L(G) if and only if there is a computation of S() that moves the pointer from 0 to jwj and terminates without making a call to reject(). The proof of Theorem 4 follows from two auxilliary statements: LEMMA 4. Let w = xyz. If there is a computation of s() (s 2 [ N) that moves the pointer from jxj to jxyj without making a call to reject(), then s =) y. Proof. Induction on the height of the tree of procedure calls. Basis: no procedure calls. Either s = a 2 and y = a, or s = A 2 N, y = and we choose the rule A! ; oth cases are trivial. Induction step. If s() makes procedure calls, then s = A 2 N. Some rule A! s 11 : : : s 1l1 & : : : &s n1 : : : s nln 2 P is selected at the rst step of the computation. Then, for each i 2 [1; n], the procedures s i1 () : : : s ili () are consequently called and each of them returns; let p ij e the value of pointer after the return from each s ij (), and let p i0 = jxj. Since our main procedure terminates and moves the pointer to jxyj, we have p 1l1 = : : : = p 1ln = jxyj. Let w e a 1 : : : a jwj. By induction hypothesis, s ij =) a pi;j?1 +1 : : : a pij (25) For all i we concatenate (25) y j to get s i1 : : : s ili =) y, which, using the previously chosen rule for A, allows to construct a derivation from A to y. 2 LEMMA 5. For any k > 0, for any conjunctive grammar G = (; N; P; S), for any w 2 L(G), for any derivation of w, for any symol s 2 [ N, for any node in the corresponding derivation tree that is laeled with s (in case s 2 ) or with some rule for s (in case s 2 N), such that there exist x; y; z 2, where w = xyz, and the mentioned node is an ancestor of those and only those terminal leaves that correspond to symols forming y, there is a computation of s() that moves the pointer from jxj to jxyj without making a call to reject(). top-down.tex; 14/10/2001; 21:09; p.20

21 Top-Down Parsing of Conjunctive Languages 21 Proof. The proof is an induction over the numer of nonepsilon descendants of the mentioned node of the derivation tree. Basis: no nonepsilon descendants. There are two cases to consider: 1. s = a 2 : this case is ovious. 2. s = A 2 N, the node is laeled with the rule A! 2 P and y =. By Denition 7, A! 2 T &SLL(k) (A; F irst k (z)), which proves the case. Induction step. Let s = A 2 N and let A! 1 & : : : & n 2 P e the rule this node is laeled with; like in the previous case, it is immediately estalished that A! 1 & : : : & n 2 T &SLL(k) (A; F irst k (yz)). For all i 2 [1; n] let j i j = l i and i = s i1 : : : s ili. There is a factorizationy = u i1 : : : u ili, where s ij =) u ij. By induction hypothesis, for all i and j there is a computation of s ij () that moves pointer from jxu i1 : : : u i;j?1 j to jxu i1 : : : u i;j?1 u ij j. Therefore, for each i, the corresponding ranch of the computation shall move pointer from jxj to jxyj, which implies that the nal condition will e met and A() shall successfully terminate, setting pointer to jxyj. 2 The time complexity of the recursive descent algorithm is again linearly dependent on the numer of steps in derivation. It is known that for every context-free grammar the numer of steps in the shortest derivation of a given string is ounded y some linear function of the length of the string. However, that is not the case for conjunctive grammars, where the length of derivation can e a higherdegree polynomial or even an exponent, as shown in [6]. For instance, the grammar S! AS & BS j a A! a B! a produces exponential-length derivations (and, esides, it is &SLL(1)). The following sucient condition of linear time complexity could e devised: PROPOSITION 1. Let G = (; N; P; S) e a &SLL(k) grammar (k > 0). If each nonterminal A 2 N that has multiple-conjunct rules is acyclic (i.e. there is no s 1 As 2 2 F, where s i 2 V, such that A =) (s) 1As 2 ), then the computation time of the corresponding &SLL(k) top-down parser is linearly ounded y the length of the input string. top-down.tex; 14/10/2001; 21:09; p.21

22 22 Alexander Okhotin Concluding Remarks It was shown that the context-free SLL(k) algorithm can e extended to the case of conjunctive grammars in a way very similar to how the conjunctive grammars themselves are formed from the context-free grammars: asically, y changing the data structures from strings to serial-parallel graphs, in which parallel composition denotes set-theoretic intersection. Some asic properties of the resulting class of &SLL(k) languages were addressed; however, no technique of proving that some conjunctive language is not &SLL(k) is known so far, which makes it hard to determine the exact scope of this language family and estalish quite proale nonclure results. Many theoretical prolems concerning the family of &SLL(k) languages remain uninvestigated: for instance, do the &SLL(k) languages form an innite hierarchy, as the context-free LL(k) languages do? Can every &SLL(k) language e represented as a nite intersection of context-free languages? Is the family of &SLL(k) languages closed under other operations esides intersection? Are there conjunctive languages that are not &SLL(k) for any k? But, independently of these yet unsolved theoretical issues, the algorithm introduced in this paper allows to extend traditional context-free top-down syntactical analysis to a suclass of conjunctive grammars, thus meeting the needs of the applications that could make use of an additional intersection operation within an existing parsing framework. References 1. A. V. Aho and J. D. Ullman, The Theory of Parsing, Translation and Compiling, Vol. I: Parsing, Prentice-Hall, M. A. Harrison, Introduction to formal language theory, Addison-Wesley, Reading, Mass., M. Latta, R. Wall, \Intersective context-free languages", Lenguajes Naturales y Lenguajes Formales IX, Barcelona, 1993, 15{ P. M. Lewis and R. E. Stearns. Syntax-directed transduction, Journal of the ACM, 15:3 (1968), 465{ L. Y. Liu and P. Weiner, \An innite hierarchy of intersections of context-free languages". Mathematical Systems Theory, 7 (1973) 187{ A. Okhotin, \Conjunctive grammars", in Pre-proceedings of DCAGRS 2000, Dept. of Computer Science, University of Western Ontario, London, Ontario, Canada. Report No. 555 (2000). 7. A. Okhotin, \Conjunctive grammars", full version of [6], Journal of Automata, Languages and Cominatorics,to appear. top-down.tex; 14/10/2001; 21:09; p.22

Computability and Complexity

Computability and Complexity Computability and Complexity Push-Down Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

An extension of recursive descent parsing for Boolean grammars

An extension of recursive descent parsing for Boolean grammars An extension of recursive descent parsing for Boolean grammars Alexander Okhotin okhotin@cs.queensu.ca Technical report 2004 475 School of Computing, Queen s University, Kingston, Ontario, Canada K7L 3N6

More information

Introduction to Formal Languages, Automata and Computability p.1/42

Introduction to Formal Languages, Automata and Computability p.1/42 Introduction to Formal Languages, Automata and Computability Pushdown Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/42 Introduction We have considered

More information

CS 4120 Lecture 3 Automating lexical analysis 29 August 2011 Lecturer: Andrew Myers. 1 DFAs

CS 4120 Lecture 3 Automating lexical analysis 29 August 2011 Lecturer: Andrew Myers. 1 DFAs CS 42 Lecture 3 Automating lexical analysis 29 August 2 Lecturer: Andrew Myers A lexer generator converts a lexical specification consisting of a list of regular expressions and corresponding actions into

More information

Information and Computation 194 (2004) Boolean grammars. Alexander Okhotin

Information and Computation 194 (2004) Boolean grammars. Alexander Okhotin Information and Computation 194 (2004) 19 48 www.elsevier.com/locate/ic Boolean grammars Alexander Okhotin School of Computing, Queen s University, Kingston, Ont., Canada K7L3N6 Received 2 December 2003;

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

CPS 220 Theory of Computation

CPS 220 Theory of Computation CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of

More information

SUFFIX TREE. SYNONYMS Compact suffix trie

SUFFIX TREE. SYNONYMS Compact suffix trie SUFFIX TREE Maxime Crochemore King s College London and Université Paris-Est, http://www.dcs.kcl.ac.uk/staff/mac/ Thierry Lecroq Université de Rouen, http://monge.univ-mlv.fr/~lecroq SYNONYMS Compact suffix

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

Linear conjunctive languages are closed under complement

Linear conjunctive languages are closed under complement Linear conjunctive languages are closed under complement Alexander Okhotin okhotin@cs.queensu.ca Technical report 2002-455 Department of Computing and Information Science, Queen s University, Kingston,

More information

Plan for Today and Beginning Next week (Lexical Analysis)

Plan for Today and Beginning Next week (Lexical Analysis) Plan for Today and Beginning Next week (Lexical Analysis) Regular Expressions Finite State Machines DFAs: Deterministic Finite Automata Complications NFAs: Non Deterministic Finite State Automata From

More information

How to Pop a Deep PDA Matters

How to Pop a Deep PDA Matters How to Pop a Deep PDA Matters Peter Leupold Department of Mathematics, Faculty of Science Kyoto Sangyo University Kyoto 603-8555, Japan email:leupold@cc.kyoto-su.ac.jp Abstract Deep PDA are push-down automata

More information

CMSC 330: Organization of Programming Languages. Pushdown Automata Parsing

CMSC 330: Organization of Programming Languages. Pushdown Automata Parsing CMSC 330: Organization of Programming Languages Pushdown Automata Parsing Chomsky Hierarchy Categorization of various languages and grammars Each is strictly more restrictive than the previous First described

More information

Finite Automata and Regular Languages (part II)

Finite Automata and Regular Languages (part II) Finite Automata and Regular Languages (part II) Prof. Dan A. Simovici UMB 1 / 25 Outline 1 Nondeterministic Automata 2 / 25 Definition A nondeterministic finite automaton (ndfa) is a quintuple M = (A,

More information

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write: Languages A language is a set (usually infinite) of strings, also known as sentences Each string consists of a sequence of symbols taken from some alphabet An alphabet, V, is a finite set of symbols, e.g.

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 3: Finite State Automata Motivation In the previous lecture we learned how to formalize

More information

Pseudo-automata for generalized regular expressions

Pseudo-automata for generalized regular expressions Pseudo-automata for generalized regular expressions B. F. Melnikov A. A. Melnikova Astract In this paper we introduce a new formalism which is intended for representing a special extensions of finite automata.

More information

The WHILE Hierarchy of Program Schemes is Infinite

The WHILE Hierarchy of Program Schemes is Infinite The WHILE Hierarchy of Program Schemes is Infinite Can Adam Alayrak and Thomas Noll RWTH Aachen Ahornstr. 55, 52056 Aachen, Germany alayrak@informatik.rwth-aachen.de and noll@informatik.rwth-aachen.de

More information

Introduction to Theory of Computing

Introduction to Theory of Computing CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages

More information

Theory of Computation

Theory of Computation Theory of Computation (Feodor F. Dragan) Department of Computer Science Kent State University Spring, 2018 Theory of Computation, Feodor F. Dragan, Kent State University 1 Before we go into details, what

More information

Pushdown Automata (2015/11/23)

Pushdown Automata (2015/11/23) Chapter 6 Pushdown Automata (2015/11/23) Sagrada Familia, Barcelona, Spain Outline 6.0 Introduction 6.1 Definition of PDA 6.2 The Language of a PDA 6.3 Euivalence of PDA s and CFG s 6.4 Deterministic PDA

More information

straight segment and the symbol b representing a corner, the strings ababaab, babaaba and abaabab represent the same shape. In order to learn a model,

straight segment and the symbol b representing a corner, the strings ababaab, babaaba and abaabab represent the same shape. In order to learn a model, The Cocke-Younger-Kasami algorithm for cyclic strings Jose Oncina Depto. de Lenguajes y Sistemas Informaticos Universidad de Alicante E-03080 Alicante (Spain) e-mail: oncina@dlsi.ua.es Abstract The chain-code

More information

arxiv: v2 [cs.fl] 21 Mar 2014

arxiv: v2 [cs.fl] 21 Mar 2014 arxiv:143.581v [cs.fl] 1 Mar 14 Enforcing Operational Properties including Blockfreeness for Deterministic Pushdown Automata S. Schneider and U. Nestmann Technische Universität Berlin Astract: We present

More information

Reversal of regular languages and state complexity

Reversal of regular languages and state complexity Reversal of regular languages and state complexity Juraj Šeej Institute of Computer Science, Faculty of Science, P. J. Šafárik University Jesenná 5, 04001 Košice, Slovakia juraj.seej@gmail.com Astract.

More information

Lecture 6 January 15, 2014

Lecture 6 January 15, 2014 Advanced Graph Algorithms Jan-Apr 2014 Lecture 6 January 15, 2014 Lecturer: Saket Sourah Scrie: Prafullkumar P Tale 1 Overview In the last lecture we defined simple tree decomposition and stated that for

More information

Languages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet:

Languages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet: Languages 1 Languages A language is a set of strings String: A sequence of letters Examples: cat, dog, house, Defined over an alphaet: a,, c,, z 2 Alphaets and Strings We will use small alphaets: Strings

More information

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

Section 1 (closed-book) Total points 30

Section 1 (closed-book) Total points 30 CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes

More information

Syntax Analysis Part I

Syntax Analysis Part I 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2013 2 Position of a Parser in the Compiler Model Source Program Lexical Analyzer

More information

October 6, Equivalence of Pushdown Automata with Context-Free Gramm

October 6, Equivalence of Pushdown Automata with Context-Free Gramm Equivalence of Pushdown Automata with Context-Free Grammar October 6, 2013 Motivation Motivation CFG and PDA are equivalent in power: a CFG generates a context-free language and a PDA recognizes a context-free

More information

Fundamentele Informatica II

Fundamentele Informatica II Fundamentele Informatica II Answer to selected exercises 5 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 5.1.a (q 0, ab, Z 0 ) (q 1, b,

More information

Pushdown Automata: Introduction (2)

Pushdown Automata: Introduction (2) Pushdown Automata: Introduction Pushdown automaton (PDA) M = (K, Σ, Γ,, s, A) where K is a set of states Σ is an input alphabet Γ is a set of stack symbols s K is the start state A K is a set of accepting

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in

Fall 1999 Formal Language Theory Dr. R. Boyer. 1. There are other methods of nding a regular expression equivalent to a nite automaton in Fall 1999 Formal Language Theory Dr. R. Boyer Week Four: Regular Languages; Pumping Lemma 1. There are other methods of nding a regular expression equivalent to a nite automaton in addition to the ones

More information

Chapter 6. Properties of Regular Languages

Chapter 6. Properties of Regular Languages Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is

More information

TECHNISCHE UNIVERSITÄT DRESDEN. Fakultät Informatik. Technische Berichte Technical Reports. D. Kirsten 1 G. Richomme 2. TUD/FI99/03 - April 1999

TECHNISCHE UNIVERSITÄT DRESDEN. Fakultät Informatik. Technische Berichte Technical Reports. D. Kirsten 1 G. Richomme 2. TUD/FI99/03 - April 1999 TECHNISCHE UNIVERSITÄT DRESDEN Fakultät Informatik Technische Berichte Technical Reports ISSN 1430-211X TUD/FI99/03 - April 1999 D. Kirsten 1 G. Richomme 2 1 Institut für Softwaretechnik I, Grundlagen

More information

Program Analysis. Lecture 5. Rayna Dimitrova WS 2016/2017

Program Analysis. Lecture 5. Rayna Dimitrova WS 2016/2017 Program Analysis Lecture 5 Rayna Dimitrova WS 2016/2017 2/21 Recap: Constant propagation analysis Goal: For each program point, determine whether a variale has a constant value whenever an execution reaches

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

CISC4090: Theory of Computation

CISC4090: Theory of Computation CISC4090: Theory of Computation Chapter 2 Context-Free Languages Courtesy of Prof. Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Spring, 2014 Overview In Chapter

More information

Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan

Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Language Processing Systems Prof. Mohamed Hamada Software Engineering La. The University of izu Japan Syntax nalysis (Parsing) 1. Uses Regular Expressions to define tokens 2. Uses Finite utomata to recognize

More information

CSE302: Compiler Design

CSE302: Compiler Design CSE302: Compiler Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering P.C. Rossin College of Engineering & Applied Science Lehigh University February 27, 2007 Outline Recap

More information

Syntax Analysis Part I

Syntax Analysis Part I 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2013 2 Position of a Parser in the Compiler Model Source Program Lexical Analyzer

More information

Abstract It is shown that formulas in monadic second order logic (mso) with one free variable can be mimicked by attribute grammars with a designated

Abstract It is shown that formulas in monadic second order logic (mso) with one free variable can be mimicked by attribute grammars with a designated Attribute Grammars and Monadic Second Order Logic Roderick Bloem October 15, 1996 Abstract It is shown that formulas in monadic second order logic (mso) with one free variable can be mimicked by attribute

More information

Some hierarchies for the communication complexity measures of cooperating grammar systems

Some hierarchies for the communication complexity measures of cooperating grammar systems Some hierarchies for the communication complexity measures of cooperating grammar systems Juraj Hromkovic 1, Jarkko Kari 2, Lila Kari 2 June 14, 2010 Abstract We investigate here the descriptional and

More information

Accept or reject. Stack

Accept or reject. Stack Pushdown Automata CS351 Just as a DFA was equivalent to a regular expression, we have a similar analogy for the context-free grammar. A pushdown automata (PDA) is equivalent in power to contextfree grammars.

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Sequences and Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis Context-free grammars Derivations Parse Trees Left-recursive grammars Top-down parsing non-recursive predictive parsers construction of parse tables Bottom-up parsing shift/reduce parsers LR parsers GLR

More information

Minimizing a convex separable exponential function subject to linear equality constraint and bounded variables

Minimizing a convex separable exponential function subject to linear equality constraint and bounded variables Minimizing a convex separale exponential function suect to linear equality constraint and ounded variales Stefan M. Stefanov Department of Mathematics Neofit Rilski South-Western University 2700 Blagoevgrad

More information

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen Pushdown Automata Notes on Automata and Theory of Computation Chia-Ping Chen Department of Computer Science and Engineering National Sun Yat-Sen University Kaohsiung, Taiwan ROC Pushdown Automata p. 1

More information

A shrinking lemma for random forbidding context languages

A shrinking lemma for random forbidding context languages Theoretical Computer Science 237 (2000) 149 158 www.elsevier.com/locate/tcs A shrinking lemma for random forbidding context languages Andries van der Walt a, Sigrid Ewert b; a Department of Mathematics,

More information

Computational Models: Class 3

Computational Models: Class 3 Computational Models: Class 3 Benny Chor School of Computer Science Tel Aviv University November 2, 2015 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

From its very inception, one fundamental theme in automata theory is the quest for understanding the relative power of the various constructs of the t

From its very inception, one fundamental theme in automata theory is the quest for understanding the relative power of the various constructs of the t From Bidirectionality to Alternation Nir Piterman a; Moshe Y. Vardi b;1 a eizmann Institute of Science, Department of Computer Science, Rehovot 76100, Israel b Rice University, Department of Computer Science,

More information

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation CFL Hierarchy CFL Decision Problems Your Questions? Previous class days' material Reading Assignments HW 12 or 13 problems Anything else I have included some slides online

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation Bottom-up parsing Pumping Theorem for CFLs Recap: Going One Way Lemma: Each context-free language is accepted by some PDA. Proof (by construction): The idea: Let the stack

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 September 2, 2004 These supplementary notes review the notion of an inductive definition and

More information

Non-elementary Lower Bound for Propositional Duration. Calculus. A. Rabinovich. Department of Computer Science. Tel Aviv University

Non-elementary Lower Bound for Propositional Duration. Calculus. A. Rabinovich. Department of Computer Science. Tel Aviv University Non-elementary Lower Bound for Propositional Duration Calculus A. Rabinovich Department of Computer Science Tel Aviv University Tel Aviv 69978, Israel 1 Introduction The Duration Calculus (DC) [5] is a

More information

EXAM. CS331 Compiler Design Spring Please read all instructions, including these, carefully

EXAM. CS331 Compiler Design Spring Please read all instructions, including these, carefully EXAM Please read all instructions, including these, carefully There are 7 questions on the exam, with multiple parts. You have 3 hours to work on the exam. The exam is open book, open notes. Please write

More information

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 4 out of 5 ETH Zürich (D-ITET) October, 12 2017 Last week, we showed the equivalence of DFA, NFA and REX

More information

1.3 Regular Expressions

1.3 Regular Expressions 51 1.3 Regular Expressions These have an important role in descriing patterns in searching for strings in many applications (e.g. awk, grep, Perl,...) All regular expressions of alphaet are 1.Øand are

More information

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van ngelen, Flora State University, 2007 Position of a Parser in the Compiler Model 2 Source Program Lexical Analyzer Lexical

More information

Kirsten Lackner Solberg. Dept. of Math. and Computer Science. Odense University, Denmark

Kirsten Lackner Solberg. Dept. of Math. and Computer Science. Odense University, Denmark Inference Systems for Binding Time Analysis Kirsten Lackner Solberg Dept. of Math. and Computer Science Odense University, Denmark e-mail: kls@imada.ou.dk June 21, 1993 Contents 1 Introduction 4 2 Review

More information

Chapter 1. Formal Definition and View. Lecture Formal Pushdown Automata on the 28th April 2009

Chapter 1. Formal Definition and View. Lecture Formal Pushdown Automata on the 28th April 2009 Chapter 1 Formal and View Lecture on the 28th April 2009 Formal of PA Faculty of Information Technology Brno University of Technology 1.1 Aim of the Lecture 1 Define pushdown automaton in a formal way

More information

Parsing -3. A View During TD Parsing

Parsing -3. A View During TD Parsing Parsing -3 Deterministic table-driven parsing techniques Pictorial view of TD and BU parsing BU (shift-reduce) Parsing Handle, viable prefix, items, closures, goto s LR(k): SLR(1), LR(1) Problems with

More information

Parsing with CFGs L445 / L545 / B659. Dept. of Linguistics, Indiana University Spring Parsing with CFGs. Direction of processing

Parsing with CFGs L445 / L545 / B659. Dept. of Linguistics, Indiana University Spring Parsing with CFGs. Direction of processing L445 / L545 / B659 Dept. of Linguistics, Indiana University Spring 2016 1 / 46 : Overview Input: a string Output: a (single) parse tree A useful step in the process of obtaining meaning We can view the

More information

Parsing with CFGs. Direction of processing. Top-down. Bottom-up. Left-corner parsing. Chart parsing CYK. Earley 1 / 46.

Parsing with CFGs. Direction of processing. Top-down. Bottom-up. Left-corner parsing. Chart parsing CYK. Earley 1 / 46. : Overview L545 Dept. of Linguistics, Indiana University Spring 2013 Input: a string Output: a (single) parse tree A useful step in the process of obtaining meaning We can view the problem as searching

More information

UNIT-VIII COMPUTABILITY THEORY

UNIT-VIII COMPUTABILITY THEORY CONTEXT SENSITIVE LANGUAGE UNIT-VIII COMPUTABILITY THEORY A Context Sensitive Grammar is a 4-tuple, G = (N, Σ P, S) where: N Set of non terminal symbols Σ Set of terminal symbols S Start symbol of the

More information

Finite-State Transducers

Finite-State Transducers Finite-State Transducers - Seminar on Natural Language Processing - Michael Pradel July 6, 2007 Finite-state transducers play an important role in natural language processing. They provide a model for

More information

On Controllability and Normality of Discrete Event. Dynamical Systems. Ratnesh Kumar Vijay Garg Steven I. Marcus

On Controllability and Normality of Discrete Event. Dynamical Systems. Ratnesh Kumar Vijay Garg Steven I. Marcus On Controllability and Normality of Discrete Event Dynamical Systems Ratnesh Kumar Vijay Garg Steven I. Marcus Department of Electrical and Computer Engineering, The University of Texas at Austin, Austin,

More information

of acceptance conditions (nite, looping and repeating) for the automata. It turns out,

of acceptance conditions (nite, looping and repeating) for the automata. It turns out, Reasoning about Innite Computations Moshe Y. Vardi y IBM Almaden Research Center Pierre Wolper z Universite de Liege Abstract We investigate extensions of temporal logic by connectives dened by nite automata

More information

Branching Bisimilarity with Explicit Divergence

Branching Bisimilarity with Explicit Divergence Branching Bisimilarity with Explicit Divergence Ro van Glaeek National ICT Australia, Sydney, Australia School of Computer Science and Engineering, University of New South Wales, Sydney, Australia Bas

More information

Predictive parsing as a specific subclass of recursive descent parsing complexity comparisons with general parsing

Predictive parsing as a specific subclass of recursive descent parsing complexity comparisons with general parsing Plan for Today Recall Predictive Parsing when it works and when it doesn t necessary to remove left-recursion might have to left-factor Error recovery for predictive parsers Predictive parsing as a specific

More information

Computing the acceptability semantics. London SW7 2BZ, UK, Nicosia P.O. Box 537, Cyprus,

Computing the acceptability semantics. London SW7 2BZ, UK, Nicosia P.O. Box 537, Cyprus, Computing the acceptability semantics Francesca Toni 1 and Antonios C. Kakas 2 1 Department of Computing, Imperial College, 180 Queen's Gate, London SW7 2BZ, UK, ft@doc.ic.ac.uk 2 Department of Computer

More information

arxiv: v1 [cs.fl] 4 Feb 2013

arxiv: v1 [cs.fl] 4 Feb 2013 Incomplete Transition Complexity of Basic Operations on Finite Languages Eva Maia, Nelma Moreira, Rogério Reis arxiv:1302.0750v1 [cs.fl] 4 Fe 2013 CMUP & DCC, Faculdade de Ciências da Universidade do Porto

More information

Symposium on Theoretical Aspects of Computer Science 2008 (Bordeaux), pp

Symposium on Theoretical Aspects of Computer Science 2008 (Bordeaux), pp Symposium on Theoretical Aspects of Computer Science 2008 (Bordeaux), pp. 373-384 www.stacs-conf.org COMPLEXITY OF SOLUTIONS OF EQUATIONS OVER SETS OF NATURAL NUMBERS ARTUR JEŻ 1 AND ALEXANDER OKHOTIN

More information

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages and and Department of Computer Science and Information Systems Birkbeck, University of London ptw@dcs.bbk.ac.uk Outline and Doing and analysing problems/languages computability/solvability/decidability

More information

Automata, Logic and Games: Theory and Application

Automata, Logic and Games: Theory and Application Automata, Logic and Games: Theory and Application 2 Parity Games, Tree Automata, and S2S Luke Ong University of Oxford TACL Summer School University of Salerno, 14-19 June 2015 Luke Ong S2S 14-19 June

More information

Compiler Construction Lent Term 2015 Lectures (of 16)

Compiler Construction Lent Term 2015 Lectures (of 16) Compiler Construction Lent Term 2015 Lectures 13 --- 16 (of 16) 1. Return to lexical analysis : application of Theory of Regular Languages and Finite Automata 2. Generating Recursive descent parsers 3.

More information

The Mean Version One way to write the One True Regression Line is: Equation 1 - The One True Line

The Mean Version One way to write the One True Regression Line is: Equation 1 - The One True Line Chapter 27: Inferences for Regression And so, there is one more thing which might vary one more thing aout which we might want to make some inference: the slope of the least squares regression line. The

More information

From EBNF to PEG. Roman R. Redziejowski. Giraf s Research

From EBNF to PEG. Roman R. Redziejowski. Giraf s Research From EBNF to PEG Roman R. Redziejowski Giraf s Research roman.redz@swipnet.se Abstract. Parsing Expression Grammar (PEG) is a way to define a recursive-descent parser with limited backtracking. Its properties

More information

Fall 1999 Formal Language Theory Dr. R. Boyer. Theorem. For any context free grammar G; if there is a derivation of w 2 from the

Fall 1999 Formal Language Theory Dr. R. Boyer. Theorem. For any context free grammar G; if there is a derivation of w 2 from the Fall 1999 Formal Language Theory Dr. R. Boyer Week Seven: Chomsky Normal Form; Pumping Lemma 1. Universality of Leftmost Derivations. Theorem. For any context free grammar ; if there is a derivation of

More information

The Accepting Power of Finite. Faculty of Mathematics, University of Bucharest. Str. Academiei 14, 70109, Bucharest, ROMANIA

The Accepting Power of Finite. Faculty of Mathematics, University of Bucharest. Str. Academiei 14, 70109, Bucharest, ROMANIA The Accepting Power of Finite Automata Over Groups Victor Mitrana Faculty of Mathematics, University of Bucharest Str. Academiei 14, 70109, Bucharest, ROMANIA Ralf STIEBE Faculty of Computer Science, University

More information

Chapter 3. Regular grammars

Chapter 3. Regular grammars Chapter 3 Regular grammars 59 3.1 Introduction Other view of the concept of language: not the formalization of the notion of effective procedure, but set of words satisfying a given set of rules Origin

More information

Computational Models - Lecture 3

Computational Models - Lecture 3 Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover

More information

Lecture 14 - P v.s. NP 1

Lecture 14 - P v.s. NP 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) February 27, 2018 Lecture 14 - P v.s. NP 1 In this lecture we start Unit 3 on NP-hardness and approximation

More information

Einführung in die Computerlinguistik

Einführung in die Computerlinguistik Einführung in die Computerlinguistik Context-Free Grammars formal properties Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2018 1 / 20 Normal forms (1) Hopcroft and Ullman (1979) A normal

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Rewriting Systems and Chomsky Grammars CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard

More information

automaton model of self-assembling systems is presented. The model operates on one-dimensional strings that are assembled from a given multiset of sma

automaton model of self-assembling systems is presented. The model operates on one-dimensional strings that are assembled from a given multiset of sma Self-Assembling Finite Automata Andreas Klein Institut fur Mathematik, Universitat Kassel Heinrich Plett Strae 40, D-34132 Kassel, Germany klein@mathematik.uni-kassel.de Martin Kutrib Institut fur Informatik,

More information

The complexity of unary tiling recognizable picture languages: nondeterministic and unambiguous cases

The complexity of unary tiling recognizable picture languages: nondeterministic and unambiguous cases Fundamenta Informaticae X (2) 1 20 1 IOS Press The complexity of unary tiling recognizale picture languages: nondeterministic and unamiguous cases Alerto Bertoni Massimiliano Goldwurm Violetta Lonati Dipartimento

More information

CS 420, Spring 2018 Homework 4 Solutions. 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0};

CS 420, Spring 2018 Homework 4 Solutions. 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0}; CS 420, Spring 2018 Homework 4 Solutions 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0}; Solution: Given p 1, choose s = 0 2p 10 p. Then, s is in the

More information

Context Free Grammars

Context Free Grammars Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

UNIT-VI PUSHDOWN AUTOMATA

UNIT-VI PUSHDOWN AUTOMATA Syllabus R09 Regulation UNIT-VI PUSHDOWN AUTOMATA The context free languages have a type of automaton that defined them. This automaton, called a pushdown automaton, is an extension of the nondeterministic

More information

Compiler Construction Lent Term 2015 Lectures (of 16)

Compiler Construction Lent Term 2015 Lectures (of 16) Compiler Construction Lent Term 2015 Lectures 13 --- 16 (of 16) 1. Return to lexical analysis : application of Theory of Regular Languages and Finite Automata 2. Generating Recursive descent parsers 3.

More information

1 Introduction It will be convenient to use the inx operators a b and a b to stand for maximum (least upper bound) and minimum (greatest lower bound)

1 Introduction It will be convenient to use the inx operators a b and a b to stand for maximum (least upper bound) and minimum (greatest lower bound) Cycle times and xed points of min-max functions Jeremy Gunawardena, Department of Computer Science, Stanford University, Stanford, CA 94305, USA. jeremy@cs.stanford.edu October 11, 1993 to appear in the

More information

Extracted from a working draft of Goldreich s FOUNDATIONS OF CRYPTOGRAPHY. See copyright notice.

Extracted from a working draft of Goldreich s FOUNDATIONS OF CRYPTOGRAPHY. See copyright notice. 106 CHAPTER 3. PSEUDORANDOM GENERATORS Using the ideas presented in the proofs of Propositions 3.5.3 and 3.5.9, one can show that if the n 3 -bit to l(n 3 ) + 1-bit function used in Construction 3.5.2

More information

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES Contents i SYLLABUS UNIT - I CHAPTER - 1 : AUT UTOMA OMATA Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 2 : FINITE AUT UTOMA OMATA An Informal Picture of Finite Automata,

More information

arxiv: v1 [cs.ds] 9 Apr 2018

arxiv: v1 [cs.ds] 9 Apr 2018 From Regular Expression Matching to Parsing Philip Bille Technical University of Denmark phbi@dtu.dk Inge Li Gørtz Technical University of Denmark inge@dtu.dk arxiv:1804.02906v1 [cs.ds] 9 Apr 2018 Abstract

More information

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton

More information

Chapter 4: Context-Free Grammars

Chapter 4: Context-Free Grammars Chapter 4: Context-Free Grammars 4.1 Basics of Context-Free Grammars Definition A context-free grammars, or CFG, G is specified by a quadruple (N, Σ, P, S), where N is the nonterminal or variable alphabet;

More information