简体   繁体   English

在寻找 Gammar 的追随者时感到困惑

[英]Confusion in finding follow of Gammar

I have confusion in finding follow of Grammar我对寻找语法的关注感到困惑

S->(L)|a S->(L)|a
L->L,S|S L->L,S|S

Follow(L)={$,} or Follow(L)= {$}关注(L)={$,} 或关注(L)= {$}
Which one is right and why?哪一个是对的,为什么?

Both are incorrect.两者都不正确。

FOLLOW(A) of non-terminal A is the set of terminal symbols 
that can follow in the derivation sequence

FOLLOW(L), check where it appears in the right hand side of productions. FOLLOW(L),检查它出现在作品右侧的位置。 It is there in它在里面

             S->(L)  

when this production is considered for derivation, what follows L is ).当考虑推导这个产生式时,L 后面的内容是 )。

            L->L,S

similarly, when this production is considered for derivation, what follows L is,.类似地,当考虑推导这个产生式时,L 后面的内容是,。

           FOLLOW(L) = {),,}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM