# Models of Computation II: Grammars and Pushdown Automata

Size: px
Start display at page:

Download "Models of Computation II: Grammars and Pushdown Automata"

Transcription

1 Models of Computation II: Grammars and Pushdown Automata COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018

2 Catch Up / Drop in Lab Session 1 Monday at Room 2.41 Building 145 Session 2 Tuesday at Room 2.41 Building 145 Session 3 Wednesday at Room 3.41 Bulding 145 Session 4 Friday at Room 3.41 Building 145 This is not a tutorial, but we re happy to answer all your questions. No registration or anything required just drop by! 1 / 59

3 Formal Languages A Reminder of Terminology The alphabet or vocabulary of a formal language is a set of tokens (or letters). It is usually denoted Σ. A string over Σ is a sequence of tokens, or the null-string ɛ. sequence may be empty, giving empty string ɛ ababc is a string over Σ = {a, b, c} A language with alphabet Σ is some set of strings over Σ. For example, the set of all strings Σ or the set of all strings of even length, {w Σ w has even length} Notation. Σ is the set of all strings over Σ. Therefore, every language with alphabet Σ is some subset of Σ. 2 / 59

4 Specifying Languages Languages can be given... as a finite enumeration, e.g. L = {ɛ, a, ab, abb} as a set, by giving a predicate, e.g. L = {w Σ P(w)} some alphabet) algebraically by regular expressions, e.g. L = L(r) for regexp r by an automaton, e.g. L = L(A) for some FSA A by a grammar (this lecture) Grammar. a concept that has been invented in linguistics to describe natural languages describes how strings are contructed rather than how membership can be checked (e.g. by an automaton) the main tool to describe syntax. 3 / 59

5 Grammars in general Formal Definition. A grammar is a quadruple V t, V n, S, P where V t is a finite set of terminal symbols (the alphabet) V n is a finite set of non-terminal symbols disjoint from V t (Notation: V = V t V n ) S is a distinguished non-terminal symbol called the start symbol P is a set of productions, written where α β α V V n V (i.e. at least one non-terminal in α) β V (i.e. β is any list of symbols) 4 / 59

6 Example The grammar G = {a, b}, {S, A}, S, {S aab, aa aaab, A ɛ} has the following components: Terminals: {a, b} Non-terminals: {S, A} Start symbol: S Productions: S aab aa aaab A ɛ Notation. Often, we just list the productions P, as all other components can be inferred (S is the standard notation for the start symbol) The notation α β 1 β n abbreviates the set of productions α β 1, α β 2,..., α β n (like for inductive data types) 5 / 59

7 Derivations Intuition. A production α β tells you what you can make if you have α: you can turn it into β. The production α β allows us to re-write any string γαρ to γβρ. Notation: γαρ γβρ Derivations. α β if α can be re-written to β in 0 or more steps so is the reflexive transitive closure of. Language of a grammar. informally: all strings of terminal symbols that can be generated from the start symbol S formally: L(G) = {w V t S w} Sentential Forms of a grammar. informally: all strings (may contain non-terminals) that can be generated from S formally: S(G) = {w V S w}. 6 / 59

8 Example Productions of the grammar G. S aab, aa aaab, A ɛ. Example Derivation. S aab aaabb aaaabbb aaabbb last string aaabbb is a sentence, others are sentential forms Language of grammar G. L(G) = {a n b n n N, n 1} Alternative Grammar for the same language S asb, S ab. (Grammars and languages are not in 1-1 correspondence) 7 / 59

9 The Chomsky Hierarchy By Noam Chomsky (a linguist!), according to the form of productions: Unrestricted: (type 0) no constraints. Context-sensitive: (type 1) the length of the left hand side of each production must not exceed the length of the right (with one exception). Context-free: (type 2) the left of each production must be a single non-terminal. Regular: (type 3) As for type 2, and the right of each production is also constrained (details to come). (There are lots of intermediate type, too.) 8 / 59

10 Classification of Languages Definition. A language is type n if it can be generated by a type n grammar. Immediate Fact. Every language of type n + 1 is also of type n. Establishing that a language is of type n give a grammar of type n that generate the language usually the easier task Disproving that a language is of type n must show that no type n-grammar generates the language usually a difficult problem 9 / 59

11 Example language {a n b n n N, n 1} Different grammars for this language Unrestricted (type 0): S aab aa aaab A ɛ Context-free (type 2): S ab S asb Recall. We know from last week that there is no DFA accepting L We will see that this means that there s no regular grammar so the language is context-free, but not regular. 10 / 59

12 Regular (Type 3) Grammars Definition. A grammar is regular if all it s productions are either right-linear, i.e. of the form or left-linear, i.e. of the form A ab or A a or A ɛ A Ba or A a or A ɛ. right and left linear grammars are equivalent: they generate the same languages we focus on right linear (for no deep reason) i.e. one symbol is generated at a time (cf. DFA/NFA!) termination with terminal symbols or ɛ Next Goal. Regular Grammars generate precisely all regular languages. 11 / 59

13 Regular Languages - Many Views Theorem. Let L be a language. Then the following are equivalent: So far. L is the language generated by a right-linear grammar; L is the language generated by a left-linear grammar; L is the language accepted by some DFA; L is the language accepted by some NFA; L is the language specified by a regular expression. have seen that NFAs and DFAs generate the same languages (subset construction) have hinted at regular expressions and NFAs generate the same languages Goal. Show that NFAs and right-linear grammars generate the same languages. 12 / 59

14 From NFAs to Right-linear Grammars Given. Take an NFA A = (Σ, S, S, F, R). alphabet, state set, initial state, final states, transition relation Construction of a right-linear grammar terminal symbols are elements of the alphabet Σ non-terminal symbols are the states S; start symbol is the start state S; productions are constructed as follows: Each transition T a U Each final state gives production T au gives production T F T ɛ (Formally, a transition T a U means (T, a, U) R.) Observation. The grammar so generated is right-linear, and hence regular. 13 / 59

15 NFAs to Right-linear Grammars - Example Given. A non-deterministic automaton S a S 1 S b 2 c S3 a b c Equivalent Grammar obtained by construction S as S 2 cs 2 S as 1 S 2 cs 3 S 1 bs 1 S 3 ε S 1 bs 2 Exercise. Convince yourself that the NFA accepts precisely the words that the grammar generates. 14 / 59

16 From Right-linear Grammars to NFAs Given. Right-linear grammar (V t, V n, S, P) terminals, non-terminals, start symbol, productions Construction of an equivalent NFA has alphabet is the terminal symbols V t states are the non-terminal symbols V n together with new state S f (for final) start state is the start symbol S; final states are S f and all non-terminals T such that there exists a production T ε. transition relation is constructed as follows: Each production gives transition T au T a U Each transition T a gives transition T a S f 15 / 59

17 Right-linear Grammars to NFAs - Example Given. Grammar G with the productions S 0 S 1T T ε T 0T T 1T (generates binary strings without leading zeros) Equivalent Automaton obtained by construction. 0 S f S 1 T 0, 1 Exercise. Convince yourself that the NFA accepts precisely the words that the grammar generates. 16 / 59

18 Context-Free (Type 2) Grammars (CFGs) Recall. A grammar is type-2 or context free if all productions have the form A w where A V n is a non-terminal, and ω V is an (arbitrary) string. left side is non-terminal right side can be anything independent of context, replace LHS with RHS. In Contrast. Context-Sensitive grammars may have productions αaβ αωβ may only replace A by ω if A appears in context α β 17 / 59

19 Example Goal. Design a CFG for the language L = {a m b n c m n m n 0} Strategy. Every word ω L can be split ω = a m n a n b n c m n and hence L = {a k a n b n c k n, k 0} convenient to not have comparison between n and m generate a k... c k, i.e. same number of leading as and trailing c s fill... in the middle by a n b n, i.e. same number of as and bs use different non-terminals for both phases of the construction Resulting Grammar. (productions only) S asc T T atb ɛ 18 / 59

20 Example ctd Example Derivation. of aaabbcc: S asc atc aatbc aaatbbc aaabbc 19 / 59

21 Parse Trees Idea. Represent derivation as tree rather than as list of rule applications describes where and how productions have been applied generated word can be collected at the leaves Example for the grammar that we have just constructed S a a a S T T T ɛ c b b 20 / 59

22 The Power of Context-Free Grammars A fun example: 21 / 59

23 Parse Trees Carry Semantics Take the code if e1 then if e2 then s1 else s2 where e1, e2 are boolean expressions and s1, s2 are subprograms. Two Readings. if e1 then ( if e2 then s1 else s2 ) and if e1 then ( if e2 then s1 ) else s2 Goal. unambiguous interpretation of the code leading to determined and clear program execution. 22 / 59

24 Ambiguity Recall that we can present CFG derivations as parse trees. Until now this was mere pretty presentation; now it will become important. A context-free grammar G is unambiguous iff every string can be derived by at most one parse tree. G is ambiguous iff there exists any word w L(G) derivable by more than one parse trees. 23 / 59

25 Example: If-Then and If-Then-Else Consider the CFG S if bexp then S if bexp then S else S prog where bexp and prog stand for boolean expressions and (if-statement free) programs respectively, defined elsewhere. The string if e1 then if e2 then s1 else s2 then has two parse trees: if e1 then S S if e2 then S else S S if e1 then S else if e2 then s1 s2 s1 S S s2 24 / 59

26 Example: If-Then and If-Then-Else That grammar was ambiguous. But here s a grammar accepting the exact same language that is unambiguous: S if bexp then S T T if bexp then T else S prog There is now only one parse for if e1 then if e2 then s1 else s2. This is given on the next slide: 25 / 59

27 Example: If-Then and If-Then-Else if e1 then S S T if e2 then T else S You cannot parse this string as if e1 then ( if e2 then s1 ) else s2. s1 T s2 26 / 59

28 Reflecting on This Example Observation. more than one grammar for a language some are ambiguous, others are not ambiguity is a property of grammars Grammars for Programs. ambiguity is bad: don t know how program will execute! replace ambiguous grammar with unabiguous one Choices for converting ambiguous grammars to unabiguous ones decide on just one parse tree e.g. if e1 then ( if e2 else s1 ) else s2 vs if e1 then ( if e2 then s1 else s2 ) in example: we have chosen if e1 then ( if e2 else s1 ) else s2 27 / 59

29 What Ambiguity Isn t Question. Is the grammar with the following production ambiguous? T if bexp then T else S Reasoning. Suppose that the above production was used we can then expand either T or S first. A. This is not ambgiuity. both options give rise to the same parse tree indeed, for context-free languages it doesn t matter what production is applied first. thinking about parse trees, both expansions happen in parallel. Main Message. Parse trees provide a better representation of syntax than derivations. 28 / 59

30 Inherently Ambiguous Languages Q. Can we always remove ambiguity? Example. Language L = {a i b j c k i = j or j = k} Q. Why is this context free? A. Note that L = {a i b i c k } {a i b j c j } idea: start with production that splits between the union S T W where T is left and W is right Complete Grammar. S T W T UV W XY U aub ɛ X ax ɛ V cv ɛ Y byc ɛ 29 / 59

31 Inherently Ambiguous Languages Problem. Both left part a i b i c k and right part a i b j c j has non-empty intersection: a i b i c i Ambiguity where a, b and c are equi-numerous: U S T V a U b c V a X X S W Y b Y c ɛ ɛ ɛ ɛ Fact. There is no unambiguous grammar for this language (we don t prove this) 30 / 59

32 The Bad News Q. Can we compute an unambiguous grammar whenever one exists? Q. Can we even determine whether an unambiguous grammar exists? A. If we interpret compute and determine as by means of a program, then no. There is no program that solves this problem for all grammars input: CFG G, output: ambiguous or not. This problem is undecidable (More undecidable problems next week!) 31 / 59

33 Example: Subtraction Example. S S S int int stands for integers the intended meaning of is subtraction Ambgiguity. S S S 1 5 S Evaluation. left parse tree evaluates to 1 right parse tree evaluates to 3 so ambiguity matters! 32 / 59

34 Technique 1: Associativity Idea for ambiguity induced by binary operator (think: ) presribe implicit parentheses, e.g. a b c (a b) c make operator associate to the left or the right Left Associativity. S S int int Result can only be read as (5 3) 1 this is left associativity Right Associativity. S int S Idea. Break the symmetry one side of operator forced to lower level here: force right hand side of i to lower level 33 / 59

35 Example: Multiplication and Addition Example. Grammar for addition and multiplication S S S S + S int Ambiguity can be read as (1 + 2) 3 and 1 + (2 3) with different results also is ambiguous but this doesn t matter here. Take 1. The trick we have just seen strictly evaluate from left to right but this gives (1 + 2) 3, not intended! Goal. Want to have higher precedence than + 34 / 59

36 Technique 2: Precedence Example Grammar giving higher precedence: S S + T T T T int int Given e.g or forced to expand + first: otherwise only so + will be last operation evaluated Example. Derivation of suppose we start with S T T int stuck, as cannot generate from T Idea. Forcing operation with higher priority to lower level three levels: S, (highest), T (middle) and integers lowest-priority operation generated by highest-level nonterminal 35 / 59

37 Example: Basic Arithmetic Repeated use of + and : S S + T S T T T T U T /U U U (S) int Main Differences. have parentheses to break operator priorities, e.g. (1 + 2) 3 parentheses at lowest level, so highest priority lower-priority operator can be inside parentheses expressions of arbitrary complexity (no nesting in previous examples) 36 / 59

38 Example: Balanced Brackets Ambiguity. S ɛ (S) SS associativity: create brackets from left or from right (as before)... two ways of generating (): S SS S (S) () indeed, any expression has infinitely many parse trees Reason. More than one way to derive ɛ. 37 / 59

39 Technique 3: Controlling ɛ Alternative Grammar with only one way to derive ɛ: S ɛ T T TU U U () (T ) ɛ can only be derived from S all other derivations go through T here: combined with multple level technique ambiguity with ɛ can be hard to miss! 38 / 59

40 From Grammars to Automata So Far. regular languages correspond to regular grammars. Q. What automata correspond to context free grammars? 39 / 59

41 General Structure of Automata a0 a1 a an read head input tape Finite State Control Auxiliary Memory input tape is a set of symbols finite state control is just like for DFAs / NFAs symbols are processed and head advances new aspect: auxiliary memory Auxiliary Memory classifies languages and grammars no auxiliary memory: NFAs / DFAs: regular languages stack: push-down automata : context free languages unbounded tape: Turing machines: all languages 40 / 59

42 Push-down Automata PDAs a0 a1 a an read head input tape Finite State Control zk z2 z1 stack memory 41 / 59

43 PDAs ctd Actions of a push-down automaton change of internal state pushing or popping the stack advance to next input symbol Action dependencies. Actions generally depend on current state (of finite state control) input symbol symbol at the top of the stack Acceptance. The machine accepts if input string is fully read machine is in accepting state stack is empty Variations. acceptance with empty stack: input fully read, stack empty acceptance with final state: input fully read, machine in final state 42 / 59

44 Example Language (that cannot be recognised by a DFA) L = {a n b n n 1} cannot be recognised by a DFA can be generated by a context free grammar can be recognised by a PDA PDA design. (ad hoc, but showcases the idea) phase 1: (state q 1 ) push a s from the input onto the stack phase 2: (state q 2 ) pop a s from the stack, if there is a b on input finalise: if the stack is empty and the input is exhausted in the final state (q 3 ), accept the string. 43 / 59

45 Deterministic PDA Definition Definition. A deterministic PDA has the form (Q, q 0, F, Σ, Γ, Z, δ), where Q is the set of states, q 0 Q is the initial state and F Q are the final states; Σ is the alphabet, or set of input symbols; Γ is the set of stack symbols, and Z Γ is the initial stack symbol; δ is a (partial) transition function δ : Q (Σ {ɛ}) Γ Q Γ δ : (state, input token or ɛ, top-of-stack) (new state, stack string) Additional Requirement to ensure determinism: if δ(q, ɛ, s) is defined, then δ(q, a, s) is undefined for all a Σ ensures that automaton has at most one execution 44 / 59

46 Notation Given. Deterministic PDA with transition function δ : Q (Σ {ɛ}) Γ Q Γ δ : (state, input token or ɛ, top-of-stack) (new state, stack string) Notation. write δ(q, a, s) = q /σ σ is a string that replaces top stack symbol final states are usually underlined (q) Rationale. replacing top stack symbol gives just one operation for push and pop pop: δ(q, a, s) = q /ɛ push: δ(q, a, s) = q /ws 45 / 59

47 Two types of PDA transition Input consuming transitions δ contains (q 1, x, s) q 2 /σ automaton reads symbol x symbol x is consumed Non-consuming transitions δ contains (q 1, ɛ, s) q 2 /σ independent of input symbol can happen any time and does not consume input symbol 46 / 59

48 Example ctd Language L = {a n b n n 1} Push-down automaton starts with Z (initial stack symbol) on stack final state is q 3 (underlined) transition function (partial) given by δ(q 0, a, Z) q 1 /az push first a δ(q 1, a, a) q 1 /aa push further a s δ(q 1, b, a) q 2 /ɛ start popping a s δ(q 2, b, a) q 2 / ɛ pop further a s δ(q 2, ɛ, Z) q 3 /ɛ accept (δ is partial, i.e. undefined for many arguments) 47 / 59

49 Example ctd PDA Trace PDA configurations triples: (state, remaining input, stack) top of stack on the left (by convention) Example Execution. (q 0, aaabbb, Z) (q 1, aabbb, az) (push first a) (q 1, abbb, aaz) (push further a s) (q 1, bbb, aaaz) (push further a s) (q 2, bb, aaz) (start popping a s) (q 2, b, az) (pop further a s) (q 2, ɛ, Z) (pop further a s) (q 3, ɛ, ɛ) (accept) Accepting execution. Ends in final state, input exhausted, empty stack. 48 / 59

50 Example ctd Rejection PDA execution. Non-accepting execution. (q 0, aaba, Z) (q 1, aba, az) (q 1, ba, aaz) (q 2, a, az)??? No transition possible, stuck without reaching final state rejection happens when transition function is undefined for current configuration (state, input, top of stack) 49 / 59

51 Example: Palindromes with Centre Mark Example Language. L = {wcw R w {a, b} w R is w reversed} Deterministic PDA that accepts L Push a s and b s onto the stack as we seem them; When we see c, change state; Now try to match the tokens we are reading with the tokens on top of the stack, popping as we go; If the top of the stack is the empty stack symbol Z, pop it and enter the final state via an ɛ-transition. Hopefully our input has been used up too! Exercise. Define this formally! 50 / 59

52 Non-Deterministic PDAs Deterministic PDAs transitions are a partial function δ : Q (Σ {ɛ}) Γ Q Γ δ : (state, input token or ɛ, top-of-stack) (new state, stack string) side condition about ɛ-transitions Non-Deterministic PDAs transitions given by relation no side condition (at all). δ Q (Σ {ɛ}) Γ Q Γ Main differences for deterministic PDA: at most one transition possible for non-deterministic PDA: zero or more transitions possible 51 / 59

53 Non-Deterministic PDAs ctd. Finite Automata non-determinism is convenient but doesn t give extra power (subset construction) can convert every NFA to an equivalent DFA Push-down automata. non-determinism gives extra power cannot convert every non-deterministic PDA to deterministic PDA there are context free languages that can only be recognised by non-deterministic PDA intuition: non-determinism allows guessing Grammar / Automata correspondence non-deterministic PDAs are more important they correspond to context-free languages 52 / 59

54 Example: Even-Length Palindromes Palindromes of even length, without centre-marks L = {ww R w {a, b} w R is w reversed} this is a context-free language cannot be recognised by deterministic PDA intuitive reason: no centre-mark, so don t know when first half of word is read Non-deterministic PDA for L has the transition δ(q, ɛ, x) = r/x x {a, b, Z}, q is the push state and r the match and pop state. Intuition guess (non-deterministically) whether we need to enter match-and-pop -state automaton gets stuck if guess is not correct (no harm done) automaton accepts if guess is correct 53 / 59

55 Grammars and PDAs Theorem. Context-free languages and non-deterministic PDAs are euqivalent for every CFL L there exists a PDA that accepts L if L is accepted by a non-deterministic PDA, then L is a CFL. Proof. We only do one direction: construct PDA from CFL. this is the interesting direction for parser generators other direction quite complex. 54 / 59

56 From CFG to PDA Given. Context-Free Grammar G = (V t, V n, S, P) Construct non-deterministic PDA A = (Q, q 0, F, Σ, Γ, Z, δ) States. q 0 (initial state), q 1 (working state) and q 2 (final state). Alphabet. Σ = V t, terminal symbols of the grammar Stack Alphabet. Γ = V t V n {Z} Initialisation. push start symbol S onto stack, enter working state q 1 δ(q 0, ɛ, Z) q 1 /SZ Termination. if the stack is empty (i.e. just contains Z), terminate δ(q 1, ɛ, Z) q 2 /ɛ 55 / 59

57 From CFGs to PDAs: working state Idea. build the derivation on the stack by expanding non-terminals according to productions productions if a terminal appears that matches the input, pop it terminate, if the entire input has been consumed Expand Non-Terminals. non-terminals on the stack are replaced by right hand side of productions δ(q 1, ɛ, A) q 1 /α for all productions A α Pop Terminals. terminals on the stack are popped if they match the input δ(q 1, t, t) q 1 /ɛ for all non-terminals t Result of Construction. Non-deterministic PDA may have more than one production for a non-terminal 56 / 59

58 Example Derive a PDA for a CFG Arithmetic Expressions as a grammar: S S + T T T T U U U (S) int 1. Initialise: δ(q 0, ɛ, Z) q 1 /SZ 2. Expand non-terminals: δ(q 1, ɛ, S) q 1 /S + T δ(q 1, ɛ, T ) q 1 /U δ(q 1, ɛ, S) q 1 /T δ(q 1, ɛ, U) q 1 /(S) δ(q 1, ɛ, T ) q 1 /T U δ(q 1, ɛ, U) q 1 /int 57 / 59

59 CFG to PDA ctd 3. Match and pop terminals: δ(q 1, +, +) q 1 /ɛ δ(q 1,, ) q 1 /ɛ δ(q 1, int, int) q 1 /ɛ δ(q 1, (, () q 1 /ɛ δ(q 1, ), )) q 1 /ɛ 4. Terminate: δ(q 1, ɛ, Z) q 2 /ɛ 58 / 59

60 Example Trace (q 0, int int, Z) (q 1, int int, SZ) (q 1, int int, T Z) (q 1, int int, T UZ) (q 1, int int, U UZ) (q 1, int int, int UZ) (q 1, int, UZ) (q 1, int, UZ) (q 1, int, intz) (q 1, ɛ, Z) (q 2, ɛ, ɛ) accept 59 / 59

### Context Free Languages and Pushdown Automata

Context Free Languages and Pushdown Automata COMP2600 Formal Methods for Software Engineering Ranald Clouston Australian National University Semester 2, 2013 COMP 2600 Context Free Languages and Pushdown

### Context Free Languages

Context Free Languages COMP2600 Formal Methods for Software Engineering Katya Lebedeva Australian National University Semester 2, 2016 Slides by Katya Lebedeva and Ranald Clouston. COMP 2600 Context Free

### Languages and Compilers

Principles of Software Engineering and Operational Systems Languages and Compilers SDAGE: Level I 2012-13 3. Formal Languages, Grammars and Automata Dr Valery Adzhiev vadzhiev@bournemouth.ac.uk Office:

### JNTUWORLD. Code No: R

Code No: R09220504 R09 SET-1 B.Tech II Year - II Semester Examinations, April-May, 2012 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science and Engineering) Time: 3 hours Max. Marks: 75 Answer any five

### Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 11 Ana Bove April 26th 2018 Recap: Regular Languages Decision properties of RL: Is it empty? Does it contain this word? Contains

### Multiple Choice Questions

Techno India Batanagar Computer Science and Engineering Model Questions Subject Name: Formal Language and Automata Theory Subject Code: CS 402 Multiple Choice Questions 1. The basic limitation of an FSM

### MIT Specifying Languages with Regular Expressions and Context-Free Grammars

MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Language Definition Problem How to precisely

### CMSC 330: Organization of Programming Languages. Architecture of Compilers, Interpreters

: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Scanner Parser Static Analyzer Intermediate Representation Front End Back End Compiler / Interpreter

### Where We Are. CMSC 330: Organization of Programming Languages. This Lecture. Programming Languages. Motivation for Grammars

CMSC 330: Organization of Programming Languages Context Free Grammars Where We Are Programming languages Ruby OCaml Implementing programming languages Scanner Uses regular expressions Finite automata Parser

### Decision Properties for Context-free Languages

Previously: Decision Properties for Context-free Languages CMPU 240 Language Theory and Computation Fall 2018 Context-free languages Pumping Lemma for CFLs Closure properties for CFLs Today: Assignment

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur 603203. DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Year & Semester : III Year, V Semester Section : CSE - 1 & 2 Subject Code : CS6503 Subject

### CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG) Objectives Introduce Pushdown Automaton (PDA) Show that PDA = CFG In terms of descriptive power Pushdown Automaton (PDA) Roughly

### MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

MIT 6.035 Specifying Languages with Regular essions and Context-Free Grammars Martin Rinard Massachusetts Institute of Technology Language Definition Problem How to precisely define language Layered structure

### 14.1 Encoding for different models of computation

Lecture 14 Decidable languages In the previous lecture we discussed some examples of encoding schemes, through which various objects can be represented by strings over a given alphabet. We will begin this

### CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages Context Free Grammars and Parsing 1 Recall: Architecture of Compilers, Interpreters Source Parser Static Analyzer Intermediate Representation Front End Back

### Compiler Construction

Compiler Construction Exercises 1 Review of some Topics in Formal Languages 1. (a) Prove that two words x, y commute (i.e., satisfy xy = yx) if and only if there exists a word w such that x = w m, y =

### CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

### Architecture of Compilers, Interpreters. CMSC 330: Organization of Programming Languages. Front End Scanner and Parser. Implementing the Front End

Architecture of Compilers, Interpreters : Organization of Programming Languages ource Analyzer Optimizer Code Generator Context Free Grammars Intermediate Representation Front End Back End Compiler / Interpreter

### Context-Free Grammars

Context-Free Grammars Describing Languages We've seen two models for the regular languages: Finite automata accept precisely the strings in the language. Regular expressions describe precisely the strings

### University of Nevada, Las Vegas Computer Science 456/656 Fall 2016

University of Nevada, Las Vegas Computer Science 456/656 Fall 2016 The entire examination is 925 points. The real final will be much shorter. Name: No books, notes, scratch paper, or calculators. Use pen

### Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5 1 Not all languages are regular So what happens to the languages which are not regular? Can we still come up with a language recognizer?

### Skyup's Media. PART-B 2) Construct a Mealy machine which is equivalent to the Moore machine given in table.

Code No: XXXXX JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY, HYDERABAD B.Tech II Year I Semester Examinations (Common to CSE and IT) Note: This question paper contains two parts A and B. Part A is compulsory

### UNIT I PART A PART B

OXFORD ENGINEERING COLLEGE (NAAC ACCREDITED WITH B GRADE) DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING LIST OF QUESTIONS YEAR/SEM: III/V STAFF NAME: Dr. Sangeetha Senthilkumar SUB.CODE: CS6503 SUB.NAME:

### COMP 330 Autumn 2018 McGill University

COMP 330 Autumn 2018 McGill University Assignment 4 Solutions and Grading Guide Remarks for the graders appear in sans serif font. Question 1[25 points] A sequence of parentheses is a sequence of ( and

### CT32 COMPUTER NETWORKS DEC 2015

Q.2 a. Using the principle of mathematical induction, prove that (10 (2n-1) +1) is divisible by 11 for all n N (8) Let P(n): (10 (2n-1) +1) is divisible by 11 For n = 1, the given expression becomes (10

### CMSC 330: Organization of Programming Languages

CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

### Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016 Lecture 15 Ana Bove May 23rd 2016 More on Turing machines; Summary of the course. Overview of today s lecture: Recap: PDA, TM Push-down

### ECS 120 Lesson 7 Regular Expressions, Pt. 1

ECS 120 Lesson 7 Regular Expressions, Pt. 1 Oliver Kreylos Friday, April 13th, 2001 1 Outline Thus far, we have been discussing one way to specify a (regular) language: Giving a machine that reads a word

### CS 314 Principles of Programming Languages. Lecture 3

CS 314 Principles of Programming Languages Lecture 3 Zheng Zhang Department of Computer Science Rutgers University Wednesday 14 th September, 2016 Zheng Zhang 1 CS@Rutgers University Class Information

### Introduction to Lexing and Parsing

Introduction to Lexing and Parsing ECE 351: Compilers Jon Eyolfson University of Waterloo June 18, 2012 1 Riddle Me This, Riddle Me That What is a compiler? 1 Riddle Me This, Riddle Me That What is a compiler?

### Syntax Analysis Part I

Syntax Analysis Part I Chapter 4: Context-Free Grammars Slides adapted from : Robert van Engelen, Florida State University Position of a Parser in the Compiler Model Source Program Lexical Analyzer Token,

### 1. [5 points each] True or False. If the question is currently open, write O or Open.

University of Nevada, Las Vegas Computer Science 456/656 Spring 2018 Practice for the Final on May 9, 2018 The entire examination is 775 points. The real final will be much shorter. Name: No books, notes,

### Final Course Review. Reading: Chapters 1-9

Final Course Review Reading: Chapters 1-9 1 Objectives Introduce concepts in automata theory and theory of computation Identify different formal language classes and their relationships Design grammars

### CMSC 330: Organization of Programming Languages. Context-Free Grammars Ambiguity

CMSC 330: Organization of Programming Languages Context-Free Grammars Ambiguity Review Why should we study CFGs? What are the four parts of a CFG? How do we tell if a string is accepted by a CFG? What

### Lecture 8: Context Free Grammars

Lecture 8: Context Free s Dr Kieran T. Herley Department of Computer Science University College Cork 2017-2018 KH (12/10/17) Lecture 8: Context Free s 2017-2018 1 / 1 Specifying Non-Regular Languages Recall

### CMSC 330: Organization of Programming Languages. Context Free Grammars

CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

### Parsing III. CS434 Lecture 8 Spring 2005 Department of Computer Science University of Alabama Joel Jones

Parsing III (Top-down parsing: recursive descent & LL(1) ) (Bottom-up parsing) CS434 Lecture 8 Spring 2005 Department of Computer Science University of Alabama Joel Jones Copyright 2003, Keith D. Cooper,

### R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

R1 SET - 1 1. a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA? 2. a) Design a DFA that accepts the language over = {, 1} of all strings that

### Limits of Computation p.1/?? Limits of Computation p.2/??

Context-Free Grammars (CFG) There are languages, such as {0 n 1 n n 0} that cannot be described (specified) by finite automata or regular expressions. Context-free grammars provide a more powerful mechanism

### PART 3 - SYNTAX ANALYSIS. F. Wotawa TU Graz) Compiler Construction Summer term / 309

PART 3 - SYNTAX ANALYSIS F. Wotawa (IST @ TU Graz) Compiler Construction Summer term 2016 64 / 309 Goals Definition of the syntax of a programming language using context free grammars Methods for parsing

### CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages Lecture 5: Syntax Analysis (Parsing) Zheng (Eddy) Zhang Rutgers University January 31, 2018 Class Information Homework 1 is being graded now. The sample solution

### Decidable Problems. We examine the problems for which there is an algorithm.

Decidable Problems We examine the problems for which there is an algorithm. Decidable Problems A problem asks a yes/no question about some input. The problem is decidable if there is a program that always

### CS 44 Exam #2 February 14, 2001

CS 44 Exam #2 February 14, 2001 Name Time Started: Time Finished: Each question is equally weighted. You may omit two questions, but you must answer #8, and you can only omit one of #6 or #7. Circle the

### QUESTION BANK. Unit 1. Introduction to Finite Automata

QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )(Jun-Jul 10) 2. Obtain a DFA to accept strings of a s and b s having even

### Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

CMPSCI 601: Recall From Last Time Lecture 5 Definition: A context-free grammar (CFG) is a 4- tuple, variables = nonterminals, terminals, rules = productions,,, are all finite. 1 ( ) \$ Pumping Lemma for

### Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees

Derivations of a CFG MACM 300 Formal Languages and Automata Anoop Sarkar http://www.cs.sfu.ca/~anoop strings grow on trees strings grow on Noun strings grow Object strings Verb Object Noun Verb Object

### Theory Bridge Exam Example Questions Version of June 6, 2008

Theory Bridge Exam Example Questions Version of June 6, 2008 This is a collection of sample theory bridge exam questions. This is just to get some idea of the format of the bridge exam and the level of

### CSCE 314 Programming Languages

CSCE 314 Programming Languages Syntactic Analysis Dr. Hyunyoung Lee 1 What Is a Programming Language? Language = syntax + semantics The syntax of a language is concerned with the form of a program: how

### QUESTION BANK. Formal Languages and Automata Theory(10CS56)

QUESTION BANK Formal Languages and Automata Theory(10CS56) Chapter 1 1. Define the following terms & explain with examples. i) Grammar ii) Language 2. Mention the difference between DFA, NFA and εnfa.

### Specifying Syntax COMP360

Specifying Syntax COMP360 The most important thing in the programming language is the name. A language will not succeed without a good name. I have recently invented a very good name and now I am looking

### MA513: Formal Languages and Automata Theory Topic: Context-free Grammars (CFG) Lecture Number 18 Date: September 12, 2011

MA53: Formal Languages and Automata Theory Topic: Context-free Grammars (CFG) Lecture Number 8 Date: September 2, 20 xercise: Define a context-free grammar that represents (a simplification of) expressions

### CMSC 330: Organization of Programming Languages. Context Free Grammars

CMSC 330: Organization of Programming Languages Context Free Grammars 1 Architecture of Compilers, Interpreters Source Analyzer Optimizer Code Generator Abstract Syntax Tree Front End Back End Compiler

### Ambiguous Grammars and Compactification

Ambiguous Grammars and Compactification Mridul Aanjaneya Stanford University July 17, 2012 Mridul Aanjaneya Automata Theory 1/ 44 Midterm Review Mathematical Induction and Pigeonhole Principle Finite Automata

### Parsing. source code. while (k<=n) {sum = sum+k; k=k+1;}

Compiler Construction Grammars Parsing source code scanner tokens regular expressions lexical analysis Lennart Andersson parser context free grammar Revision 2012 01 23 2012 parse tree AST builder (implicit)

### ECS 120 Lesson 16 Turing Machines, Pt. 2

ECS 120 Lesson 16 Turing Machines, Pt. 2 Oliver Kreylos Friday, May 4th, 2001 In the last lesson, we looked at Turing Machines, their differences to finite state machines and pushdown automata, and their

### Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

Computer Language Theory Chapter 4: Decidability 1 Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

### Chapter Seven: Regular Expressions

Chapter Seven: Regular Expressions Regular Expressions We have seen that DFAs and NFAs have equal definitional power. It turns out that regular expressions also have exactly that same definitional power:

### CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION Spring 2018 http://cseweb.ucsd.edu/classes/sp18/cse105-ab/ Today's learning goals Sipser Section 2.2 Define push-down automata informally and formally Trace the computation

### Lexical Analysis. Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast!

Lexical Analysis Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast! Compiler Passes Analysis of input program (front-end) character stream

### Homework. Context Free Languages. Before We Start. Announcements. Plan for today. Languages. Any questions? Recall. 1st half. 2nd half.

Homework Context Free Languages Homework #2 returned Homework #3 due today Homework #4 Pg 133 -- Exercise 1 (use structural induction) Pg 133 -- Exercise 3 Pg 134 -- Exercise 8b,c,d Pg 135 -- Exercise

### Context-Free Grammars

Context-Free Grammars 1 Informal Comments A context-free grammar is a notation for describing languages. It is more powerful than finite automata or RE s, but still cannot define all possible languages.

### Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

Formal Languages and Compilers Lecture IV: Regular Languages and Finite Automata Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/

### LL(1) predictive parsing

LL(1) predictive parsing Informatics 2A: Lecture 11 Mary Cryan School of Informatics University of Edinburgh mcryan@staffmail.ed.ac.uk 10 October 2018 1 / 15 Recap of Lecture 10 A pushdown automaton (PDA)

### DVA337 HT17 - LECTURE 4. Languages and regular expressions

DVA337 HT17 - LECTURE 4 Languages and regular expressions 1 SO FAR 2 TODAY Formal definition of languages in terms of strings Operations on strings and languages Definition of regular expressions Meaning

### Parsing. For a given CFG G, parsing a string w is to check if w L(G) and, if it is, to find a sequence of production rules which derive w.

Parsing For a given CFG G, parsing a string w is to check if w L(G) and, if it is, to find a sequence of production rules which derive w. Since, for a given language L, there are many grammars which generates

### (a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

Code No: R05310501 Set No. 1 III B.Tech I Semester Regular Examinations, November 2008 FORMAL LANGUAGES AND AUTOMATA THEORY (Computer Science & Engineering) Time: 3 hours Max Marks: 80 Answer any FIVE

### Formal Languages and Compilers Lecture VI: Lexical Analysis

Formal Languages and Compilers Lecture VI: Lexical Analysis Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/ Formal

### Lecture Bottom-Up Parsing

Lecture 14+15 Bottom-Up Parsing CS 241: Foundations of Sequential Programs Winter 2018 Troy Vasiga et al University of Waterloo 1 Example CFG 1. S S 2. S AyB 3. A ab 4. A cd 5. B z 6. B wz 2 Stacks in

### 2. Lexical Analysis! Prof. O. Nierstrasz!

2. Lexical Analysis! Prof. O. Nierstrasz! Thanks to Jens Palsberg and Tony Hosking for their kind permission to reuse and adapt the CS132 and CS502 lecture notes.! http://www.cs.ucla.edu/~palsberg/! http://www.cs.purdue.edu/homes/hosking/!

### CS Lecture 2. The Front End. Lecture 2 Lexical Analysis

CS 1622 Lecture 2 Lexical Analysis CS 1622 Lecture 2 1 Lecture 2 Review of last lecture and finish up overview The first compiler phase: lexical analysis Reading: Chapter 2 in text (by 1/18) CS 1622 Lecture

### Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Closure Properties of CFLs; Introducing TMs CS154 Chris Pollett Apr 9, 2007. Outline Closure Properties of Context Free Languages Algorithms for CFLs Introducing Turing Machines Closure Properties of CFL

### 1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

CSE 5 Homework 2 Due: Monday October 6, 27 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments in

### Actually talking about Turing machines this time

Actually talking about Turing machines this time 10/25/17 (Using slides adapted from the book) Administrivia HW due now (Pumping lemma for context-free languages) HW due Friday (Building TMs) Exam 2 out

### Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

CS533 Class 02b: 1 c P. Heeman, 2017 CNF Pushdown Automata Definition Equivalence Overview CS533 Class 02b: 2 c P. Heeman, 2017 Chomsky Normal Form Definition 2.8: A CFG is in Chomsky normal form if every

### Optimizing Finite Automata

Optimizing Finite Automata We can improve the DFA created by MakeDeterministic. Sometimes a DFA will have more states than necessary. For every DFA there is a unique smallest equivalent DFA (fewest states

### Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama Print family (or last) name: Print given (or first) name: I have read and understand all of

### Compilers and computer architecture From strings to ASTs (2): context free grammars

1 / 1 Compilers and computer architecture From strings to ASTs (2): context free grammars Martin Berger October 2018 Recall the function of compilers 2 / 1 3 / 1 Recall we are discussing parsing Source

### Part 3. Syntax analysis. Syntax analysis 96

Part 3 Syntax analysis Syntax analysis 96 Outline 1. Introduction 2. Context-free grammar 3. Top-down parsing 4. Bottom-up parsing 5. Conclusion and some practical considerations Syntax analysis 97 Structure

### 3. Syntax Analysis. Andrea Polini. Formal Languages and Compilers Master in Computer Science University of Camerino

3. Syntax Analysis Andrea Polini Formal Languages and Compilers Master in Computer Science University of Camerino (Formal Languages and Compilers) 3. Syntax Analysis CS@UNICAM 1 / 54 Syntax Analysis: the

### TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

TAFL 1 (ECS-403) Unit- V 5.1 Turing Machine 5.2 TM as computer of Integer Function 5.2.1 Simulating Turing Machine by Computer 5.2.2 Simulating Computer by Turing Machine 5.3 Universal Turing Machine 5.4

### Theory of Computation Dr. Weiss Extra Practice Exam Solutions

Name: of 7 Theory of Computation Dr. Weiss Extra Practice Exam Solutions Directions: Answer the questions as well as you can. Partial credit will be given, so show your work where appropriate. Try to be

### Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81%

Automata Theory TEST 1 Answers Max points: 156 Grade basis: 150 Median grade: 81% 1. (2 pts) See text. You can t be sloppy defining terms like this. You must show a bijection between the natural numbers

### Lexical Analysis. Lecture 2-4

Lexical Analysis Lecture 2-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 2 1 Administrivia Moving to 60 Evans on Wednesday HW1 available Pyth manual available on line.

### Introduction to Lexical Analysis

Introduction to Lexical Analysis Outline Informal sketch of lexical analysis Identifies tokens in input string Issues in lexical analysis Lookahead Ambiguities Specifying lexical analyzers (lexers) Regular

### 1 Parsing (25 pts, 5 each)

CSC173 FLAT 2014 ANSWERS AND FFQ 30 September 2014 Please write your name on the bluebook. You may use two sides of handwritten notes. Perfect score is 75 points out of 85 possible. Stay cool and please

### Lexical Analysis. Lecture 3-4

Lexical Analysis Lecture 3-4 Notes by G. Necula, with additions by P. Hilfinger Prof. Hilfinger CS 164 Lecture 3-4 1 Administrivia I suggest you start looking at Python (see link on class home page). Please

### Context-Free Grammars

Context-Free Grammars Describing Languages We've seen two models for the regular languages: Finite automata accept precisely the strings in the language. Regular expressions describe precisely the strings

### Compiler Construction

Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Conceptual Structure of a Compiler Source code x1 := y2

### Bottom-Up Parsing. Lecture 11-12

Bottom-Up Parsing Lecture 11-12 (From slides by G. Necula & R. Bodik) 9/22/06 Prof. Hilfinger CS164 Lecture 11 1 Bottom-Up Parsing Bottom-up parsing is more general than topdown parsing And just as efficient

### Reflection in the Chomsky Hierarchy

Reflection in the Chomsky Hierarchy Henk Barendregt Venanzio Capretta Dexter Kozen 1 Introduction We investigate which classes of formal languages in the Chomsky hierarchy are reflexive, that is, contain

### PDA s. and Formal Languages. Automata Theory CS 573. Outline of equivalence of PDA s and CFG s. (see Theorem 5.3)

CS 573 Automata Theory and Formal Languages Professor Leslie Lander Lecture # 20 November 13, 2000 Greibach Normal Form (GNF) Sheila Greibach s normal form (GNF) for a CFG is one where EVERY production

### CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages Lecture 2: Syntax Analysis Zheng (Eddy) Zhang Rutgers University January 22, 2018 Announcement First recitation starts this Wednesday Homework 1 will be release

### Pushdown Automata. A PDA is an FA together with a stack.

Pushdown Automata A PDA is an FA together with a stack. Stacks A stack stores information on the last-in firstout principle. Items are added on top by pushing; items are removed from the top by popping.

### COMP-421 Compiler Design. Presented by Dr Ioanna Dionysiou

COMP-421 Compiler Design Presented by Dr Ioanna Dionysiou Administrative! [ALSU03] Chapter 3 - Lexical Analysis Sections 3.1-3.4, 3.6-3.7! Reading for next time [ALSU03] Chapter 3 Copyright (c) 2010 Ioanna

### Implementation of Lexical Analysis

Implementation of Lexical Analysis Lecture 4 (Modified by Professor Vijay Ganesh) Tips on Building Large Systems KISS (Keep It Simple, Stupid!) Don t optimize prematurely Design systems that can be tested

### Wednesday, September 9, 15. Parsers

Parsers What is a parser A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure of a program (think: diagramming a sentence) Agenda

### PS3 - Comments. Describe precisely the language accepted by this nondeterministic PDA.

University of Virginia - cs3102: Theory of Computation Spring 2010 PS3 - Comments Average: 46.6 (full credit for each question is 55 points) Problem 1: Mystery Language. (Average 8.5 / 10) In Class 7,

### Parsers. What is a parser. Languages. Agenda. Terminology. Languages. A parser has two jobs:

What is a parser Parsers A parser has two jobs: 1) Determine whether a string (program) is valid (think: grammatically correct) 2) Determine the structure of a program (think: diagramming a sentence) Agenda