Unit-3 Alc Notes

download Unit-3 Alc Notes

of 31

Transcript of Unit-3 Alc Notes

  • 8/12/2019 Unit-3 Alc Notes

    1/31

    UNIT-3

    PUSHDOWN AUTOMATA AND PARSING ALGORITHMS: pushdown automata and

    context!ee "an#ua#es$top down pa!s%n# and &ottomup pa!s%n#$p!ope!t%es oc"$app"%cat%on o pump%n# "emma'c"osu!e p!ope!t%es o c" and dec%s%on a"#o!%thms(

    PUSHDOWN AUTOMATA:

    APPLI)ATION:

    Re#u"a! "an#ua#es a!e those wh%ch a!e accepted &* %n%te automata(&ut a "an#ua#esuch as "+,a-n&-n.n/+01 cannot &e accepted &* a !e#u"a! "an#ua#e &ecause %t has to

    p!ec%se"* !emem&e! the num&e! o a2s and &2s wh%ch wou"d !e3u%!e %n%n%te num&e! ostates(hence push down automata has &een des%#ned to accept context !ee"an#ua#es(th%s %s done &* add%n# aux%""a!* memo!* %n the o!m o stac4(

    D56INITIONS:

    The pushdown automata o!m"* cons%st o 7 tup"es #%8en &* M+,3'9'''3;'

  • 8/12/2019 Unit-3 Alc Notes

    2/31

    (( a

    ?f@1'whe!e B2 cons%sts o pa%! 3'xg such that 3 %s %n Band x %s a ,not necessa!%"* p!ope!1su%x o some h,a1o! a %n 9 (2 %s de%ned aso""ows:

    0g 2,3'xg'f'1 conta%ns a"" ,p'xg'i1 such that ,3'f'1 conta%ns,p'i1 (s%mu"ate fmo8es o M %ndependent o the &ue! contents(

    FK

  • 8/12/2019 Unit-3 Alc Notes

    27/31

    Fg 2,3'axg'f'1 conta%ns a"",p'xg'i1 such that ,3'a'1 conta%ns,p'i1 ( S%mu"atemo8es o M on %nput a %n b' !emo8%n# a !om the !ont o the &ue!(

    g 2,3'fg'a'1 conta%ns,3'h,a1g'*1 o! a"" a %n9 and %n ( Load the &ue! w%thh ,a1' !ead%n# a !om M22s %nput $ the state o M !ema%n unchan#ed(

    To show that L,M21+h 0 ,L,M11%!st o&se!8e that &* one app"%cat%on o !u"e ,1'o""owed &* app"%cat%on o !u"es,01and,F1'%,3'h,a1'^1.M,p'f'j1(

    Theorem 6.&:The )6L2S a!e not c"osed unde! %nte!sect%on(

    Proo':we showed the "an#ua#e L0+?a-%&-%c-%\%/+0 @ was not a )6L( We c"a%mthat LF+? a-%&-%c-%\%/+0 and L+? a-%&-%c-%\%/+0 and J/+0@ a!e &oth )6L2s( 6o!exa'$e( a ?DA to !eco#n%

  • 8/12/2019 Unit-3 Alc Notes

    28/31

    Theorem 6.(: I L %s a )6L and R %s a !e#u"a! set' then L-R %s a )6L(

    Proo':Let L &e L,M1 o! PDA M+,Bm' 9' ' 'p;'3og'6m1

    Stac4 o M and M2

    F

    Input to

    A'MandM

    )ont!o" o M2

    Eue!

    )ont!o"

    O M

  • 8/12/2019 Unit-3 Alc Notes

    29/31

    DECISION ALGORITHM FOR CFL:

    STAT5M5NT:

    Dec%s%on a"#o!%thm o! c" %s ma%n"* used to chec4 whethe! the #%8en "an#ua#e %s%n%te'empt* o! non %n%te,%n%n%te1(

    TO PRO5:

    To chec4 whethe! the "an#ua#e %s %n%te'%n%n%te o! empt*(

    ASSUMPTIONS:

    0(the #!amma! shou"d &e %n )homs4* no!ma" o!m,cn1 w%thout p!oduct%on(F(% Vs2 %s the sta!t s*m&o" and 2!2 %s the !an4 o the s*m&o"' then the st!%n# "en#th w%"" &e#!eate! then o! e3ua" to F-!(

    I VA2 %s the !e8e!se 8e!tex assoc%ated w%th Vs2 %s the !oot node 'then the st!%n# "en#th w%""not &e #!eate! than F-!0(

    I VE2 %s the !e8e!se 8e!tex assoc%ated w%th Vs2 %s the !oot node'then the st!%n# "en#th w%""not &e #!eate!

    than F-!F(EASIS PART: ,!+;1

    )ons%de! a p!oduct%on A/a'%t %s a d%!ected ac*c"%c #!aph denoted &* A (&* theassumpt%on a non te!m%na" w%th !an4 2!2 cannot #ene!ate a st!%n# o "en#th #!eate! thanF-!(

    He!e' the !an4 o A %s 2;2(%(e,!+;1

    E* the cond%t%on "Z+F-!'su&st%tute V!2 8a"ue'

    We #et "Z+F-;

    LZ+0

    Hence %t %s p!o8ed &* cons%de!%n# the o!m A/a'we ma* de!%8e on"* a st!%n# o "en#thV02'wh%ch %s %n%te(

    INDU)TION PART:

    F

    AA

  • 8/12/2019 Unit-3 Alc Notes

    30/31

  • 8/12/2019 Unit-3 Alc Notes

    31/31

    !,A1+F' "Z+F-F

    "Z+

    !,E1 +0' "Z+F-0

    "Z+F

    !,c1 +;' "Z+F-;

    "Z+0

    hence the %n%te "en#th o! each st!%n# %s de!%8ed ((hence %t p!o8ed(

    Now'cons%de! the d%!ected c*c"%c #!aph'

    6o! the %#u!e' the !an4 cannot &e spec%%ed( hence o! the c*c"%c #!aph the "an#ua#e %s%n%n%te(

    6o! c*c"%c #!aph the "an#ua#e %s %n%te( hence the statement %s p!o8ed(

    A E

    )

    s