Syntax Analysis. Context-free grammar Top-down and bottom-up parsing. cs5363 1

Size: px
Start display at page:

Download "Syntax Analysis. Context-free grammar Top-down and bottom-up parsing. cs5363 1"

Transcription

1 Syntax Analysis Contxt-fr grammar Top-down and bottom-up parsing cs5363 1

2 Front nd Sourc program for (w = 1; w < 100; w = w * 2); Input: a stram of charactrs f o r ( `w = 1 ; w < ; w Scanning--- convrt input to a stram of words (tokns) for ( w = 1 ; w < 100 ; w Parsing---discovr th syntax/structur of sntncs forstmt assign lss assign mptystmt Lv(w) int(1) Lv(w) Lv(w) int(100) mult Lv(w) int(2) cs5363 2

3 Contxt-fr Syntax Analysis Goal: rcogniz th structur of programs Dscription of th languag Contxt-fr grammar Parsing: discovr th structur of an input string Rjct th input if it cannot b drivd from th grammar cs5363 3

4 Dscribing contxt-fr syntax Dscrib how to rcursivly compos programs/sntncs from tokns forstmt: for ( xpr ; xpr ; xpr ) stmt xpr: xpr + xpr xpr xpr xpr * xpr xpr / xpr! xpr stmt: assignmnt forstmt whilstmt cs5363 4

5 Contxt-fr Grammar A contxt-fr grammar includs (T,NT,S,P) A st of tokns or trminals --- T Atomic symbols in th languag A st of non-trminals --- NT Variabls rprsnting constructs in th languag A st of productions --- P Ruls idntifying componnts of a construct BNF: ach production has format A ::= B (or AB) whr A is a singl non-trminal B is a squnc of trminals and non-trminals A start non-trminal --- S Th main construct of th languag Backus-Naur Form: txtual formula for xprssing contxtfr grammars cs5363 5

6 Exampl: simpl xprssions BNF: a collction of production ruls ::= n + * / Non-trminals: Trminal (tokn): n, +, -, *, / Start symbol: Using CFG to dscrib rgular xprssions n ::= d n d d ::= Drivation: top-down rplacmnt of non-trminals Each rplacmnt follows a production rul On or mor drivations xist for ach program Exampl: drivations for * 20 =>*=>+*=>5+*=>5+15*=>5+15*20 =>+=>5+=>5+*=>5+15*=>5+15*20 cs5363 6

7 Pars trs and drivations Givn a CFG G=(T,NT,P,S), a sntnc si blongs to L(G) if thr is a drivation from S to si Lft-most drivation rplac th lft-most non-trminal at ach stp Right-most drivation rplac th right-most non-trminal at ach stp Pars tr: graphical rprsntation of drivations Grammar: ::= n + * / Sntnc: * 20 Drivations: =>*=>+*=>5+*=>5+15*=>5+15*20 =>+=>5+=>5+*=>5+15*=>5+15*20 Pars trs: 5 + * cs *

8 Languags dfind by CFG ::= num string id + Support both altrnativ ( ) and rcursion Cannot incorporat contxt information Cannot dtrmin th typ of variabl nams Dclaration of variabls is in th contxt (symbol tabl) Cannot nsur variabls ar always dfind bfor usd int w; 0 = w; for (w = 1; w < 100; w = 2w) a = c + 3; a = c + w cs5363 8

9 Writing CFGs Giv BNFs to dscrib th following languags All strings gnratd by RE (0 1)*11 Symmtric strings of {a,b}. For xampl aba and babab ar in th languag abab and babbb ar not in th languag All rgular xprssions ovr {0,1}. For xampl 0 1, 0*, (01 10)* ar in th languag 0 and *0 ar not in th languag For ach solution, giv an xampl input of th languag. Thn draw a pars tr for th input basd on your BNF cs5363 9

10 Abstract vs. Concrt Syntax Concrt syntax: th syntax programmrs writ Exampl: diffrnt notations of xprssions Prfix + 5 * Infix * 20 Postfix * + Abstract syntax: th structur rcognizd by compilrs Idntifis only th maningful componnts Th opration Th componnts of th opration Pars Tr for 5+15* * 20 Abstract Syntax Tr for * * cs

11 Abstract syntax trs Condnsd form of pars tr Oprators and kywords do not appar as lavs Thy dfin th maning of th intrior (parnt) nod S If-thn-ls IF B THEN S1 ELSE S2 B S1 S2 Chains of singl productions may b collapsd E E + T T cs

12 Ambiguous Grammars A grammar is syntactically ambiguous if Som program has multipl pars trs Consqunc of multipl pars trs Multipl ways to intrprt a program Grammar: ::= n + * / Sntnc: * 20 Pars trs: + * * cs

13 Rwrit ambiguous Exprssions Solution1: introduc prcdnc and associativity ruls to dictat th choics of applying production ruls ::= n + * / Prcdnc and associativity * / >> + - All oprators ar lft associativ Drivation for n+n*n =>+=>n+=>n+*=>n+n*=>n+n*n Solution2: rwrit productions with additional non-trminals E ::= E + T E T T T ::= T * F T / F F F ::= n Drivation for n + n * n E=>E+T=>T+T=>F+T=>n+T=>n+T*F=>n+F*F=>n+n*F=>n+n*n How to modify th grammar if + and - has high prcdnc than * and / All oprators ar right associativ cs

14 Rwrit Ambiguous Grammars Disambiguat composition of non-trminals Original grammar S = IF <xpr> THEN S IF <xpr> THEN S ELSE S <othr> Altrnativ grammar S ::= MS US US ::= IF <xpr> THEN MS ELSE US IF <xpr> THEN S MS ::= IF <xpr> THEN MS ELSE MS <othr> cs

15 Parsing Rcogniz th structur of programs Givn an input string, discovr its structur by constructing a pars tr Rjct th input if it cannot b drivd from th grammar Top-down parsing Construct th pars tr in a top-down rcursiv dscnt fashion Start from th root of th pars tr, build down towards lavs Bottom-up parsing Construct th pars tr in a bottom-up fashion Start from th lavs of th pars tr, build up towards th root cs

16 Top-down Parsing Start from th starting non-trminal, try to find a lft-most drivation E ::= E + T E T T T ::= T * F T / F F F ::= n T void ParsE() { if (us th first rul) { ParsE(); if (gtnxttokn()!= PLUS) ErrorRcovry() ParsT(); } ls if (us th scond rul) { } ls } void ParsT() { } void ParsF() { } - T + F T T * F 7 F F Crat a procdur for ach non-trminal S Rcogniz th languag dscribd by S Pars th whol languag in a rcursiv dscnt fashion How to dcid which production rul to us? cs

17 LL(k) Parsrs Lft-to-right, lftmost-drivation, k-symbol lookahad parsrs Th production for ach non-trminal can b dtrmind by chcking at most k input tokns LL(k) grammar: grammars that can b parsd by LL(k) parsrs LL(1) parsr: th slction of vry production can b dtrmind by th nxt input tokn Grammar: E ::= E + T E T T T ::= T * F T / F F F ::= n (E) Evry production starts with a numbr. Not LL(1) Lft rcursiv ==> not LL(K) Equivalnt LL(1) grammar : Grammar: E ::= TE E ::= + TE - TE ε T ::= FT T ::= *FT / FT ε F ::= n (E) cs

18 Eliminating lft rcursion A grammar is lft-rcursiv if it has a drivation AA for som string Lft rcursiv grammar cannot b parsd by rcursiv dscnt parsrs vn with backtracking A::=A β Grammar: E ::= E + T E T T T ::= T * F T / F F F ::= n A::= β A A ::= A ε Grammar: E ::= TE E ::= + TE - TE ε T ::= FT T ::= *FT / FT ε F ::= n Problm: Lft-rcursion could involv multipl drivations cs

19 Algorithm: Eliminating lft-rcursion 1. Arrang th non-trminals in som ordr A1,A2,,An 2. for i = 1 to n do for j = 1 to i-1 do Rplac ach production Ai::=Aj whr Aj ::= β 1 β 2 β k β with Ai::=β 1 β 2 k nd Eliminat lft-rcursion for all Ai productions nd Exampl: S ::= Aa b A ::= Ac Sd Exampl: S ::= Aa b A ::= Ac Aad bd Exampl: S ::= Aa b A ::= bda A A ::= ca ada ε cs

20 Lft factoring Whn two altrnativ productions start with th sam symbols, dlay th dcision until w can mak th right choic Can chang LL(k) into LL(1) A::=β 1 β 2 S ::= IF <xpr> THEN S ELSE S IF <xpr> THEN S <othr> A::=A A ::=β 1 β 2 S ::= IF <xpr> THEN S S <othr> S ::= ELSE S ε S ::= MS US US ::= IF <xpr> THEN MS ELSE US IF <xpr> THEN S MS ::= IF <xpr> THEN MS ELSE MS <othr> S ::= MS US US ::= IF <xpr> THEN US US ::= MS ELSE S S MS ::= IF <xpr> THEN MS ELSE MS <othr> cs

21 Prdictiv parsing tabl Grammar: E ::= TE E ::= + TE - TE ε T ::= FT T ::= *FT / FT ε F ::= n E n + - * / $ E::=TE E E ::=+TE E ::=-TE E ::= ε T T::=FT T T ::= ε T ::= ε T ::=*FT T ::=/FT T ::= ε F F::=n cs

22 Constructing Prdictiv Parsing Tabl For ach string, comput First(): trminals that can start all strings drivd from For ach non-trminal A, comput Follow(A): trminals thn can immdiatly follow A in som drivation Algorithm For ach production A::=, do For ach trminal a in First(), add A::= to M[A,a] If ε First(), add A::= to M[A,b] for ach b Follow(A). Each undfind ntry of M is rror cs

23 Comput First E ::= TE E ::= + TE - TE ε T ::= FT T ::= *FT / FT ε F ::= n Non-trminals: First(E )={+,-, ε} First(T )={*,/, ε} First(F) = {n} First(T)=First(F)={n} First(E)=First(T)={n} Strings: First(TE )={n} First(+TE )={+} First(-TE )={-} First(FT )={n} First(*FT )={*} First(/FT )={/} If X is trminal, thn First(X)= {X} If X::= ε is a production, thn ε First(X) If x::=y1y2 yk is a production, thn First(x)=First(y1y2 yk) If X=Y1Y2 Yk is a string, thn First(Y1) First(X) If ε First(Y1), ε First(Y2) ε First(Yi), thn First(Yi+1) First(X) cs

24 Comput Follow Grammar: E ::= TE E ::= + TE - TE ε T ::= FT T ::= *FT / FT ε F ::= n Non-trminals: Follow(E)={$} Follow(E )={$} Follow(T) = {$,+,-} Follow(T )={$,+,-} Follow(F)={*,/,+,-,$} If S is th start non-trminal, thn $ Follow(S) If A::=Bβ is a production, thn First(β )-{ε} Follow(B) If ε First(β ), thn Follow(A) Follow(B) If A::= B is a production, thn Follow(A) Follow(B) cs

25 Build prdictiv parsing tabls First(TE )={n} First(+TE )={+} First(-TE )={-} First(FT )={n} First(*FT )={*} First(/FT )={/} Follow(E)={$} Follow(E )={$} Follow(T) = {$,+,-} Follow(T )={$,+,-} Follow(F)={*,/,+,-,$} E n + - * / $ E::=TE E E ::=+TE E ::=-TE E ::= ε T T::=FT T T ::= ε T ::= ε T ::=*FT T ::=/FT T ::= ε F F::=n cs

26 Bottom-up Parsing Start from th input string, try rduc it to th starting nontrminal. Equivalnt to th rvrs of a right-most drivation Grammar: E ::= E + T E T T T ::= T * F T / F F F ::= n - T T Right-most drivation for 5+15*20-7: + F EE-TE-FE-7E+T-7E+T*F-7 T T * F E+T*20-7E+F*20-7E+15*20-7 T+15*20-7F+15* *20-7 F F 20 7 Bottom-up parsing: 5+15*20-7F+15*20-7T+15*20-7 E+15*20-7E+F*20-7E+T*20-7 E+T*F-7E+T-7E-7E-FE-TE 5 15 Right-sntntial form: any sntnc that can appar as an intrmdiat form of a right-most drivation. Th handl of a right-sntntial form : th substring to rduc to a non-trminal at ach stp cs

27 Handl pruning Grammar: E ::= E + T E T T T ::= T * F T / F F F ::= n Right-sntntial form Handl Rducing production 5+15*20-7 F+15*20-7 T+15*20-7 E+15*20-7 E+F*20-7 E+T*20-7 E+T*F-7 E+T-7 E-7 E-F E-T E 5 F T 15 F 20 T*F E+T 7 F E-T F::=n T::=F E::=T F::=n T::=F F::=n T::=T*F E::=E+T F::=n T::=F E::=E-T cs

28 LR(k) parsrs Lft-to-right, rightmost-drivation, k-symbol lookahad Dcisions ar mad by chcking th nxt k input tokns Us a finit automata to configur actions Automata stats rmmbr symbols to xpct for ach production Each (stat, input tokn) pair dtrmins a uniqu action Why us LR parsrs? Can rcogniz mor CFGs than can prdictiv LL(k) parsrs Can rcogniz virtually all programming languags Gnral non-backtracking mthod, fficint implmntation Can dtct rror at th lftmost position of input string Tradoff: LR(k) vs LL(k) parsrs LR parsrs ar hard to build by hand --- us automatic parsr gnrators (g., yacc) cs

29 Shift-rduc parsing Us a stack to sav symbols alrady procssd Prfix of handls procssd so far Us a finit automata to mak dcisions Stat + lookahad => action + goto stat Implmnt handl pruning through four actions Shift th currnt tokn from input string onto stack Rduc symbols on th top of stack to a non-trminal Accpt: succss Error How to locat th handl to b rducd? Which production to us in rducing a handl? Shift/rduc conflict: to shift or to rduc? Rduc/rduc conflict: choos a production to rduc cs

30 Exampl: LR(1) parsing tabl I0 n E T I1:(T::=n., $/+/*) I2:(E ::=E., $) I3(E::=T., $/+) + * n I4 I5 T * n I6:(E::=E+T., $/+) I7:T::=T*n., $/+/*) n + * $ E T 0 s1 Goto2 Goto3 1 R(T::=n) R(T::=n) R(T::=n) 2 s4 Acc 3 R(E::=T) s5 R(E::=T) 4 s1 Goto6 5 s7 6 R(E::=E+T) s5 R(E::=E+T) 7 R(T::=T*n) R(T::=T*n) R(T::=T*n)

31 LR shift-rduc parsing Stack Input Action (0) (0)5(1) (0)T (0)T(3) (0)E (0)E(2) (0)E(2)+(4) (0)E(2)+(4)15(1) (0)E(2)+(4)T (0)E(2)+(4)T(6) (0)E(2)+(4)T(6)*(5) (0)E(2)+(4)T(6)*(5)20(7) (0)E(2)+(4)T (0)E(2)+(4)T(6) (0)E (0)E(2) 5+15*20$ +15*20$ +15*20$ +15*20$ +15*20$ +15*20$ 15*20$ *20$ *20$ *20$ 20$ $ $ $ $ $ Shift 1 Rduc by T::=n Goto3 Rduc by E::=T Goto2 Shift 4 Shift 1 Rduc by T::=n Goto6 Shift5 Shift7 Rduc by T::=T*n Goto6 Rduc by E::=E+T Goto2 Accpt cs

32 Modl of an LR parsr Input a1a2.ai an$ Stack Sm Xm Sm-1 LR parsr Output Xm-1 action goto s0 Pars tabl Configuration of LR parsr: (s0x1s1x2s2 Xmsm, aiai+1 an$) Right-sntntial form: Automata stats: s0s1s2 sm X1X2 Xmaiai+1 an$ cs

33 Constructing LR parsing tabls Augmntd grammar: add a nw starting non-trminal E Build a finit automata to modl prfix of handls NFA stats: production + position of procssd symbols + lookahad Build a DFA by grouping NFA stats NFA stats: (Sα.β FOLLOW(S),γ ) whr Sαβ is a production, γ Rmmbrs th handl(α.β ) and lookahad(γ ) for ach stat Us lookahad information in automata stats LR(0): no lookahad; LR(1): look-ahad on tokn Grammar: E ::= E E ::= E + T T T ::= T * n n LR(0) itms: (NFA stats) (E ::=.E) E (E ::=E.) (E::=.T) T (E::=T.) (E::=.E+T) E (E::=E.+T) + (E::=E+.T) T (E::=E+T.) LR(1) itms: (E ::=.E,$) E (E ::=E.,$) (E::=.T,$)T(E::=T.,$) cs

34 Closur of LR(1) itms If I is a st of LR(1) itms, closur(i) Includs vry itm in I If (A::= α.bβ,a) is in closur(i), and B::=γ is a production, thn for vry b FIRST(β a), add (B::=.γ,b) to closur(i) Rpat until no mor nw itms to add Grammar: E ::= E E ::= E + T T T ::= T * n n Closur({E ::=.E,$}) = {(E ::=.E,$), (E::=.E+T,$/+), (E::=.T,$/+) (T::=.T*F,$/+/*), (T::=.n,$/+/*) } cs

35 Goto (DFA) transitions If I is a st of LR(1) itms, X is a grammar symbol, thn Goto(I,X) contains For ach (A::= α.xβ,a) in I, Closur({(A::= αx.β,a)}) Not: thr is no transition from (A::= ε, a) Cononical collction of LR(1) sts Bgin C ::= {closur({(s ::=.S,$)})} rpat for ach itm st I in C for ach grammar symbol X add Goto(I,X) to C until no mor itm sts can b addd to C cs

36 Exampl: Building DFA Grammar: E ::= E E ::= E + T T T ::= T * n n I0: {(E ::=.E,$), (E::=.E+T,$/+), (E::=.T,$/+), (T::=.T*F,$/+/*), (T::=.n,$/+/*)} Goto(I0,n): {(T::=n.,$/+/*)} I1 Goto(I0,E): {(E ::=E.,$), (E::=E.+T,$/+)} I2 Goto(I0,T): {(E::=T.,$/+), (T::=T.*n,$/+/*)} I3 Goto(I2,+): {(E::=E+.T,$/+), (T::=.T*n,$/+/*), (T::=.n,$/+/*)} I4 Goto(I3,*): {(T::=T*.n,$/+/*)} I5 Goto(I4,T): {(E::=E+T.,$/+), (T::=T.*n,$/+/*)} I6 Goto(I4,n): {(T::=n.,$/+/*)} I1 Goto(I5,n): {(T::=T*n.,$/+/*)} I7 Goto(I6,*): {(T::=T*.n,$/+/*)} I5 cs

37 LR(1) DFA Transitions I0: {(E ::=.E,$), (E::=.E+T,$/+), (E::=.T,$/+), (T::=.T*n,$/+/*), (T::=.n,$/+/*)} Goto(I0,n): {(T::=n.,$/+/*)} I1 Goto(I0,E): {(E ::=E.,$), (E::=E.+T,$/+)} I2 Goto(I0,T): {(E::=T.,$/+), (T::=T.*n,$/+/*)} I3 Goto(I2,+): {(E::=E+.T,$/+), (T::=.T*n,$/+/*), (T::=.n,$/+/*)} I4 Goto(I3,*): {(T::=T*.n,$/+/*)} I5 Goto(I4,T): {(E::=E+T.,$/+), (T::=T.*n,$/+/*)} I6 Goto(I4,n): {(T::=n.,$/+/*)} I1 Goto(I5,n): {(T::=T*n.,$/+/*)} I7 Goto(I6,*): {(T::=T*.n,$/+/*)} I5 I0 n E T I1:(T::=n., $/+/*) I2:(E ::=E., $) I3(E::=T., $/+) + * n I4 I5 T * n I6:(E::=E+T., $/+) I7:T::=T*n., $/+/*) cs

38 Constructing LR(1) Parsing Tabl Input: augmntd grammar G Output: parsing tabl functions (action and goto) Mthod: 1. Construct C={I0,I1,,In}, th canonical LR(1) collction 2. Crat a stat i for ach Ii C a) if Goto(Ii, a) = Ij and a is a trminal st action[i,a] to shift j. b) if Goto(Ii,A) = Ij and A is a non-trminal, st GOTO[i,A] to j. b) if (A::=.,a) is in Ii (not: could b ε) st action[i,a] to rduc A::= c) if (S ::=S.,$) is in Ii, st action[i,$] to accpt. cs

39 Exampl: LR(1) parsing tabl I0 n E T I1:(T::=n., $/+/*) I2:(E ::=E., $) I3(E::=T., $/+) + * n I4 I5 T * n I6:(E::=E+T., $/+) I7:T::=T*n., $/+/*) n + * $ E T 0 s1 Goto2 Goto3 1 R(T::=n) R(T::=n) R(T::=n) 2 s4 Acc 3 R(E::=T) s5 R(E::=T) 4 s1 Goto6 5 s7 6 R(E::=E+T) s5 R(E::=E+T) 7 R(T::=T*n) R(T::=T*n) R(T::=T*n)

40 Prcdnc and Associativity E ::= E + E E * E (E) id I7: {E::=E+E., E::=E.+E, E::=E.*E} Oprator + is lft-associativ on input tokn +, rduc with E::=E+E Oprator * has highr prcdnc than + on input tokn *, shift * onto stack I8: {E::=E*E., E::=E.+E, E::=E.*E} Oprator * is lft-associativ on input tokn *, rduc with E::=E*E Oprator * has highr prcdnc than + on input tokn +, rduc with E::=E*E cs

41 Parsr hirarchy LL(k) LL(1) LR(k) LR(1) LALR SLR cs

42 Summary: grammars and Parsrs Spcification and implmntation of languags Grammars spcify th syntax of languags Parsrs implmnt th spcification Contxt-fr grammars Ambiguous vs non-ambiguous grammars Lft-rcursiv grammars vs. LL parsrs Lft-factoring of grammars Parsrs Backtracking vs prdictiv parsrs LL parsrs vs LR parsrs Lookahad information cs

CS 6353 Compiler Construction, Homework #1. 1. Write regular expressions for the following informally described languages:

CS 6353 Compiler Construction, Homework #1. 1. Write regular expressions for the following informally described languages: CS 6353 Compilr Construction, Homwork #1 1. Writ rgular xprssions for th following informally dscribd languags: a. All strings of 0 s and 1 s with th substring 01*1. Answr: (0 1)*01*1(0 1)* b. All strings

More information

Lecture 4: Parsing. Administrivia

Lecture 4: Parsing. Administrivia Adminitrivia Lctur 4: Paring If you do not hav a group, pla pot a rqut on Piazzza ( th Form projct tam... itm. B ur to updat your pot if you find on. W will aign orphan to group randomly in a fw day. Programming

More information

Source code. where each α ij is a terminal or nonterminal symbol. We say that. α 1 α m 1 Bα m+1 α n α 1 α m 1 β 1 β p α m+1 α n

Source code. where each α ij is a terminal or nonterminal symbol. We say that. α 1 α m 1 Bα m+1 α n α 1 α m 1 β 1 β p α m+1 α n Adminitrivia Lctur : Paring If you do not hav a group, pla pot a rqut on Piazzza ( th Form projct tam... itm. B ur to updat your pot if you find on. W will aign orphan to group randomly in a fw day. Programming

More information

CS 361 Meeting 12 10/3/18

CS 361 Meeting 12 10/3/18 CS 36 Mting 2 /3/8 Announcmnts. Homwork 4 is du Friday. If Friday is Mountain Day, homwork should b turnd in at my offic or th dpartmnt offic bfor 4. 2. Homwork 5 will b availabl ovr th wknd. 3. Our midtrm

More information

UNTYPED LAMBDA CALCULUS (II)

UNTYPED LAMBDA CALCULUS (II) 1 UNTYPED LAMBDA CALCULUS (II) RECALL: CALL-BY-VALUE O.S. Basic rul Sarch ruls: (\x.) v [v/x] 1 1 1 1 v v CALL-BY-VALUE EVALUATION EXAMPLE (\x. x x) (\y. y) x x [\y. y / x] = (\y. y) (\y. y) y [\y. y /

More information

Context free languages

Context free languages Context free languages Syntatic parsers and parse trees E! E! *! E! (! E! )! E + E! id! id! id! 2 Context Free Grammars The CF grammar production rules have the following structure X α being X N and α

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

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018

Propositional Logic. Combinatorial Problem Solving (CPS) Albert Oliveras Enric Rodríguez-Carbonell. May 17, 2018 Propositional Logic Combinatorial Problm Solving (CPS) Albrt Olivras Enric Rodríguz-Carbonll May 17, 2018 Ovrviw of th sssion Dfinition of Propositional Logic Gnral Concpts in Logic Rduction to SAT CNFs

More information

LR(0) Analysis. LR(0) Analysis

LR(0) Analysis. LR(0) Analysis LR() Analysis LR() Conlicts: Introuction Whn constructing th LR() analysis tal scri in th prvious stps, it has not n possil to gt a trministic analysr, caus thr ar svral possil actions in th sam cll. I

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 2)

Syntax Analysis (Part 2) Syntax Analysis (Part 2) Martin Sulzmann Martin Sulzmann Syntax Analysis (Part 2) 1 / 42 Bottom-Up Parsing Idea Build right-most derivation. Scan input and seek for matching right hand sides. Terminology

More information

CONTEXT FREE GRAMMAR AND

CONTEXT FREE GRAMMAR AND CONTEXT FREE GRAMMAR AND PARSING STATIC ANALYSIS - PARSING Source language Scanner (lexical analysis) tokens Parser (syntax analysis) Syntatic structure Semantic Analysis (IC generator) Syntatic/sema ntic

More information

CA Compiler Construction

CA Compiler Construction CA4003 - Compiler Construction Bottom Up Parsing David Sinclair Bottom Up Parsing LL(1) parsers have enjoyed a bit of a revival thanks to JavaCC. LL(k) parsers must predict which production rule to use

More information

Compiler Design Spring 2017

Compiler Design Spring 2017 Compiler Design Spring 2017 3.4 Bottom-up parsing Dr. Zoltán Majó Compiler Group Java HotSpot Virtual Machine Oracle Corporation 1 Bottom up parsing Goal: Obtain rightmost derivation in reverse w S Reduce

More information

EXAM. Please read all instructions, including these, carefully NAME : Problem Max points Points 1 10 TOTAL 100

EXAM. Please read all instructions, including these, carefully NAME : Problem Max points Points 1 10 TOTAL 100 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

LR2: LR(0) Parsing. LR Parsing. CMPT 379: Compilers Instructor: Anoop Sarkar. anoopsarkar.github.io/compilers-class

LR2: LR(0) Parsing. LR Parsing. CMPT 379: Compilers Instructor: Anoop Sarkar. anoopsarkar.github.io/compilers-class LR2: LR(0) Parsing LR Parsing CMPT 379: Compilers Instructor: Anoop Sarkar anoopsarkar.github.io/compilers-class Parsing - Roadmap Parser: decision procedure: builds a parse tree Top-down vs. bottom-up

More information

Creating a Recursive Descent Parse Table

Creating a Recursive Descent Parse Table Creating a Recursive Descent Parse Table Recursive descent parsing is sometimes called LL parsing (Left to right examination of input, Left derivation) Consider the following grammar E TE' E' +TE' T FT'

More information

Bottom-Up Parsing. Ÿ rm E + F *idÿ rm E +id*idÿ rm T +id*id. Ÿ rm F +id*id Ÿ rm id + id * id

Bottom-Up Parsing. Ÿ rm E + F *idÿ rm E +id*idÿ rm T +id*id. Ÿ rm F +id*id Ÿ rm id + id * id Bottom-Up Parsing Attempts to traverse a parse tree bottom up (post-order traversal) Reduces a sequence of tokens to the start symbol At each reduction step, the RHS of a production is replaced with LHS

More information

Top-Down Parsing and Intro to Bottom-Up Parsing

Top-Down Parsing and Intro to Bottom-Up Parsing Predictive Parsers op-down Parsing and Intro to Bottom-Up Parsing Lecture 7 Like recursive-descent but parser can predict which production to use By looking at the next few tokens No backtracking Predictive

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

Bottom up parsing. General idea LR(0) SLR LR(1) LALR To best exploit JavaCUP, should understand the theoretical basis (LR parsing);

Bottom up parsing. General idea LR(0) SLR LR(1) LALR To best exploit JavaCUP, should understand the theoretical basis (LR parsing); Bottom up parsing General idea LR(0) SLR LR(1) LALR To best exploit JavaCUP, should understand the theoretical basis (LR parsing); 1 Top-down vs Bottom-up Bottom-up more powerful than top-down; Can process

More information

Syntax Analysis Part III

Syntax Analysis Part III Syntax Analysis Part III Chapter 4: Top-Down Parsing Slides adapted from : Robert van Engelen, Florida State University Eliminating Ambiguity stmt if expr then stmt if expr then stmt else stmt other The

More information

Addition of angular momentum

Addition of angular momentum Addition of angular momntum April, 0 Oftn w nd to combin diffrnt sourcs of angular momntum to charactriz th total angular momntum of a systm, or to divid th total angular momntum into parts to valuat th

More information

Homework #3. 1 x. dx. It therefore follows that a sum of the

Homework #3. 1 x. dx. It therefore follows that a sum of the Danil Cannon CS 62 / Luan March 5, 2009 Homwork # 1. Th natural logarithm is dfind by ln n = n 1 dx. It thrfor follows that a sum of th 1 x sam addnd ovr th sam intrval should b both asymptotically uppr-

More information

Compiler Design. Spring Syntactic Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

Compiler Design. Spring Syntactic Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz Compiler Design Spring 2015 Syntactic Analysis Sample Exercises and Solutions Prof. Pedro C. Diniz USC / Information Sciences Institute 4676 Admiralty Way, Suite 1001 Marina del Rey, California 90292 pedro@isi.edu

More information

Roadmap. XML Indexing. DataGuide example. DataGuides. Strong DataGuides. Multiple DataGuides for same data. CPS Topics in Database Systems

Roadmap. XML Indexing. DataGuide example. DataGuides. Strong DataGuides. Multiple DataGuides for same data. CPS Topics in Database Systems Roadmap XML Indxing CPS 296.1 Topics in Databas Systms Indx fabric Coopr t al. A Fast Indx for Smistructurd Data. VLDB, 2001 DataGuid Goldman and Widom. DataGuids: Enabling Qury Formulation and Optimization

More information

Shift-Reduce parser E + (E + (E) E [a-z] In each stage, we shift a symbol from the input to the stack, or reduce according to one of the rules.

Shift-Reduce parser E + (E + (E) E [a-z] In each stage, we shift a symbol from the input to the stack, or reduce according to one of the rules. Bottom-up Parsing Bottom-up Parsing Until now we started with the starting nonterminal S and tried to derive the input from it. In a way, this isn t the natural thing to do. It s much more logical to start

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

Introduction to Bottom-Up Parsing

Introduction to Bottom-Up Parsing Introduction to Bottom-Up Parsing Outline Review LL parsing Shift-reduce parsing The LR parsing algorithm Constructing LR parsing tables 2 Top-Down Parsing: Review Top-down parsing expands a parse tree

More information

That is, we start with a general matrix: And end with a simpler matrix:

That is, we start with a general matrix: And end with a simpler matrix: DIAGON ALIZATION OF THE STR ESS TEN SOR INTRO DUCTIO N By th us of Cauchy s thorm w ar abl to rduc th numbr of strss componnts in th strss tnsor to only nin valus. An additional simplification of th strss

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

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

Calculus concepts derivatives

Calculus concepts derivatives All rasonabl fforts hav bn mad to mak sur th nots ar accurat. Th author cannot b hld rsponsibl for any damags arising from th us of ths nots in any fashion. Calculus concpts drivativs Concpts involving

More information

Syntactic Analysis. Top-Down Parsing

Syntactic Analysis. Top-Down Parsing Syntactic Analysis Top-Down Parsing Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in Compilers class at University of Southern California (USC) have explicit permission to make

More information

Abstract Interpretation: concrete and abstract semantics

Abstract Interpretation: concrete and abstract semantics Abstract Intrprtation: concrt and abstract smantics Concrt smantics W considr a vry tiny languag that manags arithmtic oprations on intgrs valus. Th (concrt) smantics of th languags cab b dfind by th funzcion

More information

Syntax Analysis - Part 1. Syntax Analysis

Syntax Analysis - Part 1. Syntax Analysis Syntax Analysis Outline Context-Free Grammars (CFGs) Parsing Top-Down Recursive Descent Table-Driven Bottom-Up LR Parsing Algorithm How to Build LR Tables Parser Generators Grammar Issues for Programming

More information

Brief Introduction to Statistical Mechanics

Brief Introduction to Statistical Mechanics Brif Introduction to Statistical Mchanics. Purpos: Ths nots ar intndd to provid a vry quick introduction to Statistical Mchanics. Th fild is of cours far mor vast than could b containd in ths fw pags.

More information

I 1 : {S S } I 2 : {S X ay, Y X } I 3 : {S Y } I 4 : {X b Y, Y X, X by, X c} I 5 : {X c } I 6 : {S Xa Y, Y X, X by, X c} I 7 : {X by } I 8 : {Y X }

I 1 : {S S } I 2 : {S X ay, Y X } I 3 : {S Y } I 4 : {X b Y, Y X, X by, X c} I 5 : {X c } I 6 : {S Xa Y, Y X, X by, X c} I 7 : {X by } I 8 : {Y X } Let s try building an SLR parsing table for another simple grammar: S XaY Y X by c Y X S XaY Y X by c Y X Canonical collection: I 0 : {S S, S XaY, S Y, X by, X c, Y X} I 1 : {S S } I 2 : {S X ay, Y X }

More information

Compiler Design 1. LR Parsing. Goutam Biswas. Lect 7

Compiler Design 1. LR Parsing. Goutam Biswas. Lect 7 Compiler Design 1 LR Parsing Compiler Design 2 LR(0) Parsing An LR(0) parser can take shift-reduce decisions entirely on the basis of the states of LR(0) automaton a of the grammar. Consider the following

More information

n Top-down parsing vs. bottom-up parsing n Top-down parsing n Introduction n A top-down depth-first parser (with backtracking)

n Top-down parsing vs. bottom-up parsing n Top-down parsing n Introduction n A top-down depth-first parser (with backtracking) Announcements n Quiz 1 n Hold on to paper, bring over at the end n HW1 due today n HW2 will be posted tonight n Due Tue, Sep 18 at 2pm in Submitty! n Team assignment. Form teams in Submitty! n Top-down

More information

Compiler Construction Lectures 13 16

Compiler Construction Lectures 13 16 Compiler Construction Lectures 13 16 Lent Term, 2013 Lecturer: Timothy G. Griffin 1 Generating Lexical Analyzers Source Program Lexical Analyzer tokens Parser Lexical specification Scanner Generator LEX

More information

Parsing Algorithms. CS 4447/CS Stephen Watt University of Western Ontario

Parsing Algorithms. CS 4447/CS Stephen Watt University of Western Ontario Parsing Algorithms CS 4447/CS 9545 -- Stephen Watt University of Western Ontario The Big Picture Develop parsers based on grammars Figure out properties of the grammars Make tables that drive parsing engines

More information

Ambiguity, Precedence, Associativity & Top-Down Parsing. Lecture 9-10

Ambiguity, Precedence, Associativity & Top-Down Parsing. Lecture 9-10 Ambiguity, Precedence, Associativity & Top-Down Parsing Lecture 9-10 (From slides by G. Necula & R. Bodik) 2/13/2008 Prof. Hilfinger CS164 Lecture 9 1 Administrivia Team assignments this evening for all

More information

Compilerconstructie. najaar Rudy van Vliet kamer 124 Snellius, tel rvvliet(at)liacs.

Compilerconstructie. najaar Rudy van Vliet kamer 124 Snellius, tel rvvliet(at)liacs. Compilerconstructie najaar 2012 http://www.liacs.nl/home/rvvliet/coco/ Rudy van Vliet kamer 124 Snellius, tel. 071-527 5777 rvvliet(at)liacs.nl werkcollege 9, dinsdag 27 november 2012 SLR Parsing / Backpatching

More information

Abstract Interpretation. Lecture 5. Profs. Aiken, Barrett & Dill CS 357 Lecture 5 1

Abstract Interpretation. Lecture 5. Profs. Aiken, Barrett & Dill CS 357 Lecture 5 1 Abstract Intrprtation 1 History On brakthrough papr Cousot & Cousot 77 (?) Inspird by Dataflow analysis Dnotational smantics Enthusiastically mbracd by th community At last th functional community... At

More information

ME 321 Kinematics and Dynamics of Machines S. Lambert Winter 2002

ME 321 Kinematics and Dynamics of Machines S. Lambert Winter 2002 3.4 Forc Analysis of Linkas An undrstandin of forc analysis of linkas is rquird to: Dtrmin th raction forcs on pins, tc. as a consqunc of a spcifid motion (don t undrstimat th sinificanc of dynamic or

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

EEO 401 Digital Signal Processing Prof. Mark Fowler

EEO 401 Digital Signal Processing Prof. Mark Fowler EEO 401 Digital Signal Procssing Prof. Mark Fowlr Dtails of th ot St #19 Rading Assignmnt: Sct. 7.1.2, 7.1.3, & 7.2 of Proakis & Manolakis Dfinition of th So Givn signal data points x[n] for n = 0,, -1

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

u r du = ur+1 r + 1 du = ln u + C u sin u du = cos u + C cos u du = sin u + C sec u tan u du = sec u + C e u du = e u + C

u r du = ur+1 r + 1 du = ln u + C u sin u du = cos u + C cos u du = sin u + C sec u tan u du = sec u + C e u du = e u + C Tchniqus of Intgration c Donald Kridr and Dwight Lahr In this sction w ar going to introduc th first approachs to valuating an indfinit intgral whos intgrand dos not hav an immdiat antidrivativ. W bgin

More information

Introduction to Bottom-Up Parsing

Introduction to Bottom-Up Parsing Introduction to Bottom-Up Parsing Outline Review LL parsing Shift-reduce parsing The LR parsing algorithm Constructing LR parsing tables Compiler Design 1 (2011) 2 Top-Down Parsing: Review Top-down parsing

More information

First derivative analysis

First derivative analysis Robrto s Nots on Dirntial Calculus Chaptr 8: Graphical analysis Sction First drivativ analysis What you nd to know alrady: How to us drivativs to idntiy th critical valus o a unction and its trm points

More information

Why augment the grammar?

Why augment the grammar? Why augment the grammar? Consider -> F + F FOLLOW F -> i ---------------- 0:->.F+ ->.F F->.i i F 2:F->i. Action Goto + i $ F ----------------------- 0 s2 1 1 s3? 2 r3 r3 3 s2 4 1 4? 1:->F.+ ->F. i 4:->F+.

More information

General Notes About 2007 AP Physics Scoring Guidelines

General Notes About 2007 AP Physics Scoring Guidelines AP PHYSICS C: ELECTRICITY AND MAGNETISM 2007 SCORING GUIDELINES Gnral Nots About 2007 AP Physics Scoring Guidlins 1. Th solutions contain th most common mthod of solving th fr-rspons qustions and th allocation

More information

Introduction to Bottom-Up Parsing

Introduction to Bottom-Up Parsing Outline Introduction to Bottom-Up Parsing Review LL parsing Shift-reduce parsing he LR parsing algorithm Constructing LR parsing tables 2 op-down Parsing: Review op-down parsing expands a parse tree from

More information

Final Exam Solutions

Final Exam Solutions CS 2 Advancd Data Structurs and Algorithms Final Exam Solutions Jonathan Turnr /8/20. (0 points) Suppos that r is a root of som tr in a Fionacci hap. Assum that just for a dltmin opration, r has no childrn

More information

Kernels. ffl A kernel K is a function of two objects, for example, two sentence/tree pairs (x1; y1) and (x2; y2)

Kernels. ffl A kernel K is a function of two objects, for example, two sentence/tree pairs (x1; y1) and (x2; y2) Krnls krnl K is a function of two ojcts, for xampl, two sntnc/tr pairs (x1; y1) an (x2; y2) K((x1; y1); (x2; y2)) Intuition: K((x1; y1); (x2; y2)) is a masur of th similarity (x1; y1) twn (x2; y2) an ormally:

More information

Voltage, Current, Power, Series Resistance, Parallel Resistance, and Diodes

Voltage, Current, Power, Series Resistance, Parallel Resistance, and Diodes Lctur 1. oltag, Currnt, Powr, Sris sistanc, Paralll sistanc, and Diods Whn you start to dal with lctronics thr ar thr main concpts to start with: Nam Symbol Unit oltag volt Currnt ampr Powr W watt oltag

More information

Administrivia. Test I during class on 10 March. Bottom-Up Parsing. Lecture An Introductory Example

Administrivia. Test I during class on 10 March. Bottom-Up Parsing. Lecture An Introductory Example Administrivia Test I during class on 10 March. Bottom-Up Parsing Lecture 11-12 From slides by G. Necula & R. Bodik) 2/20/08 Prof. Hilfinger CS14 Lecture 11 1 2/20/08 Prof. Hilfinger CS14 Lecture 11 2 Bottom-Up

More information

Introduction to Bottom-Up Parsing

Introduction to Bottom-Up Parsing Outline Introduction to Bottom-Up Parsing Review LL parsing Shift-reduce parsing he LR parsing algorithm Constructing LR parsing tables Compiler Design 1 (2011) 2 op-down Parsing: Review op-down parsing

More information

Higher order derivatives

Higher order derivatives Robrto s Nots on Diffrntial Calculus Chaptr 4: Basic diffrntiation ruls Sction 7 Highr ordr drivativs What you nd to know alrady: Basic diffrntiation ruls. What you can larn hr: How to rpat th procss of

More information

Construction of asymmetric orthogonal arrays of strength three via a replacement method

Construction of asymmetric orthogonal arrays of strength three via a replacement method isid/ms/26/2 Fbruary, 26 http://www.isid.ac.in/ statmath/indx.php?modul=prprint Construction of asymmtric orthogonal arrays of strngth thr via a rplacmnt mthod Tian-fang Zhang, Qiaoling Dng and Alok Dy

More information

ECE 407 Computer Aided Design for Electronic Systems. Instructor: Maria K. Michael. Overview. CAD tools for multi-level logic synthesis:

ECE 407 Computer Aided Design for Electronic Systems. Instructor: Maria K. Michael. Overview. CAD tools for multi-level logic synthesis: 407 Computr Aidd Dsign for Elctronic Systms Multi-lvl Logic Synthsis Instructor: Maria K. Michal 1 Ovrviw Major Synthsis Phass Logic Synthsis: 2-lvl Multi-lvl FSM CAD tools for multi-lvl logic synthsis:

More information

MCB137: Physical Biology of the Cell Spring 2017 Homework 6: Ligand binding and the MWC model of allostery (Due 3/23/17)

MCB137: Physical Biology of the Cell Spring 2017 Homework 6: Ligand binding and the MWC model of allostery (Due 3/23/17) MCB37: Physical Biology of th Cll Spring 207 Homwork 6: Ligand binding and th MWC modl of allostry (Du 3/23/7) Hrnan G. Garcia March 2, 207 Simpl rprssion In class, w drivd a mathmatical modl of how simpl

More information

CS 406: Bottom-Up Parsing

CS 406: Bottom-Up Parsing CS 406: Bottom-Up Parsing Stefan D. Bruda Winter 2016 BOTTOM-UP PUSH-DOWN AUTOMATA A different way to construct a push-down automaton equivalent to a given grammar = shift-reduce parser: Given G = (N,

More information

Addition of angular momentum

Addition of angular momentum Addition of angular momntum April, 07 Oftn w nd to combin diffrnt sourcs of angular momntum to charactriz th total angular momntum of a systm, or to divid th total angular momntum into parts to valuat

More information

Computer Science 160 Translation of Programming Languages

Computer Science 160 Translation of Programming Languages Computer Science 160 Translation of Programming Languages Instructor: Christopher Kruegel Building a Handle Recognizing Machine: [now, with a look-ahead token, which is LR(1) ] LR(k) items An LR(k) item

More information

Association (Part II)

Association (Part II) Association (Part II) nanopoulos@ismll.d Outlin Improving Apriori (FP Growth, ECLAT) Qustioning confidnc masur Qustioning support masur 2 1 FP growth Algorithm Us a comprssd rprsntation of th dtb databas

More information

The Matrix Exponential

The Matrix Exponential Th Matrix Exponntial (with xrciss) by Dan Klain Vrsion 28928 Corrctions and commnts ar wlcom Th Matrix Exponntial For ach n n complx matrix A, dfin th xponntial of A to b th matrix () A A k I + A + k!

More information

Chemical Physics II. More Stat. Thermo Kinetics Protein Folding...

Chemical Physics II. More Stat. Thermo Kinetics Protein Folding... Chmical Physics II Mor Stat. Thrmo Kintics Protin Folding... http://www.nmc.ctc.com/imags/projct/proj15thumb.jpg http://nuclarwaponarchiv.org/usa/tsts/ukgrabl2.jpg http://www.photolib.noaa.gov/corps/imags/big/corp1417.jpg

More information

Dealing with quantitative data and problem solving life is a story problem! Attacking Quantitative Problems

Dealing with quantitative data and problem solving life is a story problem! Attacking Quantitative Problems Daling with quantitati data and problm soling lif is a story problm! A larg portion of scinc inols quantitati data that has both alu and units. Units can sa your butt! Nd handl on mtric prfixs Dimnsional

More information

The Matrix Exponential

The Matrix Exponential Th Matrix Exponntial (with xrciss) by D. Klain Vrsion 207.0.05 Corrctions and commnts ar wlcom. Th Matrix Exponntial For ach n n complx matrix A, dfin th xponntial of A to b th matrix A A k I + A + k!

More information

TuLiP: A Software Toolbox for Receding Horizon Temporal Logic Planning & Computer Lab 2

TuLiP: A Software Toolbox for Receding Horizon Temporal Logic Planning & Computer Lab 2 TuLiP: A Softwar Toolbox for Rcding Horizon Tmporal Logic Planning & Computr Lab 2 Nok Wongpiromsarn Richard M. Murray Ufuk Topcu EECI, 21 March 2013 Outlin Ky Faturs of TuLiP Embddd control softwar synthsis

More information

2.3 Matrix Formulation

2.3 Matrix Formulation 23 Matrix Formulation 43 A mor complicatd xampl ariss for a nonlinar systm of diffrntial quations Considr th following xampl Exampl 23 x y + x( x 2 y 2 y x + y( x 2 y 2 (233 Transforming to polar coordinats,

More information

Electrochemistry L E O

Electrochemistry L E O Rmmbr from CHM151 A rdox raction in on in which lctrons ar transfrrd lctrochmistry L O Rduction os lctrons xidation G R ain lctrons duction W can dtrmin which lmnt is oxidizd or rducd by assigning oxidation

More information

Strongly Connected Components

Strongly Connected Components Strongly Connctd Componnts Lt G = (V, E) b a dirctd graph Writ if thr is a path from to in G Writ if and is an quivalnc rlation: implis and implis s quivalnc classs ar calld th strongly connctd componnts

More information

Numbering Systems Basic Building Blocks Scaling and Round-off Noise. Number Representation. Floating vs. Fixed point. DSP Design.

Numbering Systems Basic Building Blocks Scaling and Round-off Noise. Number Representation. Floating vs. Fixed point. DSP Design. Numbring Systms Basic Building Blocks Scaling and Round-off Nois Numbr Rprsntation Viktor Öwall viktor.owall@it.lth.s Floating vs. Fixd point In floating point a valu is rprsntd by mantissa dtrmining th

More information

The pn junction: 2 Current vs Voltage (IV) characteristics

The pn junction: 2 Current vs Voltage (IV) characteristics Th pn junction: Currnt vs Voltag (V) charactristics Considr a pn junction in quilibrium with no applid xtrnal voltag: o th V E F E F V p-typ Dpltion rgion n-typ Elctron movmnt across th junction: 1. n

More information

The Transmission Line Wave Equation

The Transmission Line Wave Equation 1//5 Th Transmission Lin Wav Equation.doc 1/6 Th Transmission Lin Wav Equation Q: So, what functions I (z) and V (z) do satisfy both tlgraphr s quations?? A: To mak this asir, w will combin th tlgraphr

More information

1 Isoparametric Concept

1 Isoparametric Concept UNIVERSITY OF CALIFORNIA BERKELEY Dpartmnt of Civil Enginring Spring 06 Structural Enginring, Mchanics and Matrials Profssor: S. Govindj Nots on D isoparamtric lmnts Isoparamtric Concpt Th isoparamtric

More information

Introduction to Arithmetic Geometry Fall 2013 Lecture #20 11/14/2013

Introduction to Arithmetic Geometry Fall 2013 Lecture #20 11/14/2013 18.782 Introduction to Arithmtic Gomtry Fall 2013 Lctur #20 11/14/2013 20.1 Dgr thorm for morphisms of curvs Lt us rstat th thorm givn at th nd of th last lctur, which w will now prov. Thorm 20.1. Lt φ:

More information

1 Minimum Cut Problem

1 Minimum Cut Problem CS 6 Lctur 6 Min Cut and argr s Algorithm Scribs: Png Hui How (05), Virginia Dat: May 4, 06 Minimum Cut Problm Today, w introduc th minimum cut problm. This problm has many motivations, on of which coms

More information

Elements of Statistical Thermodynamics

Elements of Statistical Thermodynamics 24 Elmnts of Statistical Thrmodynamics Statistical thrmodynamics is a branch of knowldg that has its own postulats and tchniqus. W do not attmpt to giv hr vn an introduction to th fild. In this chaptr,

More information

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 7a Syntax Analysis Elias Athanasopoulos

ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών. Lecture 7a Syntax Analysis Elias Athanasopoulos ΕΠΛ323 - Θεωρία και Πρακτική Μεταγλωττιστών Lecture 7a Syntax Analysis Elias Athanasopoulos eliasathan@cs.ucy.ac.cy Operator-precedence Parsing A class of shiq-reduce parsers that can be writen by hand

More information

COMPUTER GENERATED HOLOGRAMS Optical Sciences 627 W.J. Dallas (Monday, April 04, 2005, 8:35 AM) PART I: CHAPTER TWO COMB MATH.

COMPUTER GENERATED HOLOGRAMS Optical Sciences 627 W.J. Dallas (Monday, April 04, 2005, 8:35 AM) PART I: CHAPTER TWO COMB MATH. C:\Dallas\0_Courss\03A_OpSci_67\0 Cgh_Book\0_athmaticalPrliminaris\0_0 Combath.doc of 8 COPUTER GENERATED HOLOGRAS Optical Scincs 67 W.J. Dallas (onday, April 04, 005, 8:35 A) PART I: CHAPTER TWO COB ATH

More information

A False History of True Concurrency

A False History of True Concurrency A Fals History of Tru Concurrncy Javir Esparza Sofwar Rliability and Scurity Group Institut for Formal Mthods in Computr Scinc Univrsity of Stuttgart. Th arly 6s. 2 Abstract Modls of Computation in th

More information

Slide 1. Slide 2. Slide 3 DIGITAL SIGNAL PROCESSING CLASSIFICATION OF SIGNALS

Slide 1. Slide 2. Slide 3 DIGITAL SIGNAL PROCESSING CLASSIFICATION OF SIGNALS Slid DIGITAL SIGAL PROCESSIG UIT I DISCRETE TIME SIGALS AD SYSTEM Slid Rviw of discrt-tim signals & systms Signal:- A signal is dfind as any physical quantity that varis with tim, spac or any othr indpndnt

More information

Probability Translation Guide

Probability Translation Guide Quick Guid to Translation for th inbuilt SWARM Calculator If you s information looking lik this: Us this statmnt or any variant* (not th backticks) And this is what you ll s whn you prss Calculat Th chancs

More information

Aim To manage files and directories using Linux commands. 1. file Examines the type of the given file or directory

Aim To manage files and directories using Linux commands. 1. file Examines the type of the given file or directory m E x. N o. 3 F I L E M A N A G E M E N T Aim To manag ils and dirctoris using Linux commands. I. F i l M a n a g m n t 1. il Examins th typ o th givn il or dirctory i l i l n a m > ( o r ) < d i r c t

More information

CSC 4181Compiler Construction. Context-Free Grammars Using grammars in parsers. Parsing Process. Context-Free Grammar

CSC 4181Compiler Construction. Context-Free Grammars Using grammars in parsers. Parsing Process. Context-Free Grammar CSC 4181Compiler Construction Context-ree Grammars Using grammars in parsers CG 1 Parsing Process Call the scanner to get tokens Build a parse tree from the stream of tokens A parse tree shows the syntactic

More information

MATH 319, WEEK 15: The Fundamental Matrix, Non-Homogeneous Systems of Differential Equations

MATH 319, WEEK 15: The Fundamental Matrix, Non-Homogeneous Systems of Differential Equations MATH 39, WEEK 5: Th Fundamntal Matrix, Non-Homognous Systms of Diffrntial Equations Fundamntal Matrics Considr th problm of dtrmining th particular solution for an nsmbl of initial conditions For instanc,

More information

1 Recursive Descent (LL(1) grammars)

1 Recursive Descent (LL(1) grammars) UNIVERSITY OF CALIFORNIA Dparmn of Elcrical Enginring and Compur Scincs Compur Scinc Division CS 164 Fall 2001 R. J. Faman CS 164: Programming Languags and Compilrs: Parsing Prviously, I 1 discussd wha

More information

CS20a: summary (Oct 24, 2002)

CS20a: summary (Oct 24, 2002) CS20a: summary (Oct 24, 2002) Context-free languages Grammars G = (V, T, P, S) Pushdown automata N-PDA = CFG D-PDA < CFG Today What languages are context-free? Pumping lemma (similar to pumping lemma for

More information

CPSC 665 : An Algorithmist s Toolkit Lecture 4 : 21 Jan Linear Programming

CPSC 665 : An Algorithmist s Toolkit Lecture 4 : 21 Jan Linear Programming CPSC 665 : An Algorithmist s Toolkit Lctur 4 : 21 Jan 2015 Lcturr: Sushant Sachdva Linar Programming Scrib: Rasmus Kyng 1. Introduction An optimization problm rquirs us to find th minimum or maximum) of

More information

Exam 1. It is important that you clearly show your work and mark the final answer clearly, closed book, closed notes, no calculator.

Exam 1. It is important that you clearly show your work and mark the final answer clearly, closed book, closed notes, no calculator. Exam N a m : _ S O L U T I O N P U I D : I n s t r u c t i o n s : It is important that you clarly show your work and mark th final answr clarly, closd book, closd nots, no calculator. T i m : h o u r

More information

u 3 = u 3 (x 1, x 2, x 3 )

u 3 = u 3 (x 1, x 2, x 3 ) Lctur 23: Curvilinar Coordinats (RHB 8.0 It is oftn convnint to work with variabls othr than th Cartsian coordinats x i ( = x, y, z. For xampl in Lctur 5 w mt sphrical polar and cylindrical polar coordinats.

More information

Chapter 6 Folding. Folding

Chapter 6 Folding. Folding Chaptr 6 Folding Wintr 1 Mokhtar Abolaz Folding Th folding transformation is usd to systmatically dtrmin th control circuits in DSP architctur whr multipl algorithm oprations ar tim-multiplxd to a singl

More information

Chapter 8: Electron Configurations and Periodicity

Chapter 8: Electron Configurations and Periodicity Elctron Spin & th Pauli Exclusion Principl Chaptr 8: Elctron Configurations and Priodicity 3 quantum numbrs (n, l, ml) dfin th nrgy, siz, shap, and spatial orintation of ach atomic orbital. To xplain how

More information

Problem Set 6 Solutions

Problem Set 6 Solutions 6.04/18.06J Mathmatics for Computr Scinc March 15, 005 Srini Dvadas and Eric Lhman Problm St 6 Solutions Du: Monday, March 8 at 9 PM in Room 3-044 Problm 1. Sammy th Shark is a financial srvic providr

More information

4. (5a + b) 7 & x 1 = (3x 1)log 10 4 = log (M1) [4] d = 3 [4] T 2 = 5 + = 16 or or 16.

4. (5a + b) 7 & x 1 = (3x 1)log 10 4 = log (M1) [4] d = 3 [4] T 2 = 5 + = 16 or or 16. . 7 7 7... 7 7 (n )0 7 (M) 0(n ) 00 n (A) S ((7) 0(0)) (M) (7 00) 8897 (A). (5a b) 7 7... (5a)... (M) 7 5 5 (a b ) 5 5 a b (M)(A) So th cofficint is 75 (A) (C) [] S (7 7) (M) () 8897 (A) (C) [] 5. x.55

More information