Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的语法中有一条规则,例如
A -> B C D E {: ...some actions... :}
;
D -> /*empty*/ {: some actions using attributes of B and C :}
为了实现与 D 的生产规则相关的动作,我需要访问解析器堆栈。我怎样才能在 CUP 中做到这一点?
重写你的语法:
A -> A1 E A1 -> B C D
如果第一个产生式的动作也需要Band C,那么 的语义值A1必须更复杂才能传递语义值。
B
C
A1