[英]what is the LL(1) grammar for it statement?
我想將 LALR(1) 語法轉換為 LL(1) 語法,尤其是 if 語句。
我在 if 語句中使用了 LALR(1) 語法
IF_Stmt -> Matched|Unmatched.
Matched -> if ( Expr_IF ) Matched else Matched | Other.
Unmatched -> if ( Expr_IF ) Matched
|if ( Expr_IF ) Matched else Unmatched.
在這里,我意識到我必須刪除左因子分解。
之后我無法解決epsilon生產問題......
if 語句的 LL(1) 語法是什么?
IF_Stmt -> if ( Expr_IF ) Stmt Optional_Else_Stmt
Optional_Else_Stmt -> (empty-string)
|else Stmt.
Stmt -> if ( Expr ) Matched Optional_Else_Tail
| Other
Matched -> if ( Expr ) Matched else Matched
| Other
Optional_Else_Tail -> else Stmt
| ""
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.