已知算符优先关系矩阵如下表:
+ |
* |
i |
( |
) |
# |
|
+ |
> |
< |
< |
< |
> |
> |
* |
> |
> |
< |
< |
> |
> |
i |
> |
> |
> |
> |
||
( |
< |
< |
< |
< |
= |
|
) |
> |
> |
> |
> |
||
# |
< |
< |
< |
< |
= |
写出符号串#(i+i)*i#的算符优先分析过程。
栈 |
关系 |
输入串 |
动作 |
# |
< |
(i+i)*i# |
移进 |
#( |
< |
i+i)*i# |
移进 |
#(i |
> |
+i)*i# |
归约 |
#(E |
< |
+i)*i# |
移进 |
#(E+ |
< |
i)*i# |
移进 |
#(E+i |
> |
)*i# |
归约 |
#(E+E |
< |
)*i# |
移进 |
#(E+E) |
< |
*i# |
移进 |
#(E+E)* |
< |
i# |
移进 |
#(E+E)*i |
> |
# |
归约 |
#(E+E)*E |
< |
# |
移进 |
#(E+E)*E# |
结束 |
原文地址:https://www.cnblogs.com/a131452/p/12020506.html
时间: 2024-10-16 10:54:21