Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.4.6 练习4.4.1 a)没有左递归吧,感觉不需要消除左递归 #158

Open
FubinSama opened this issue Jun 12, 2019 · 5 comments
Open

Comments

@FubinSama
Copy link

S -> 0 A
A -> S 1 | 1

@FubinSama
Copy link
Author

感觉我跟博主对消除左递归的算法的理解有点不一样。算法中说将非终结符排成一个序列A1,A2,...,Ak。然后用k做的循环,感觉上不需要把在消除左递归过程中产生的新的非终结符加入序列,并动态的扩大k值。如果需要加入序列的话,作者写的算法中,应该会有说明吧。

@chenyi110
Copy link

同问,感觉这个不是左递归啊

@KONG98
Copy link

KONG98 commented Jun 21, 2019

赞同楼上,这个没有左递归的吧。

@wangyuxiang0829
Copy link

感觉我跟博主对消除左递归的算法的理解有点不一样。算法中说将非终结符排成一个序列A1,A2,...,Ak。然后用k做的循环,感觉上不需要把在消除左递归过程中产生的新的非终结符加入序列,并动态的扩大k值。如果需要加入序列的话,作者写的算法中,应该会有说明吧。

你理解错意思了,这里就是严格按照书上的算法来的,
S -> 0 A
A->S | 1 》 A -> 0 A 1 | 1
这一步是为了保证性质:所有产生式Ak->Al a都满足l>k成立

@lawrshen
Copy link

lawrshen commented Oct 1, 2021

这里也不是间接左递归吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants