简体   繁体   English

it 语句的 LL(1) 语法是什么?

[英]what is the LL(1) grammar for it statement?

I want to convert LALR(1) grammar to LL(1) grammar especially if statement.我想将 LALR(1) 语法转换为 LL(1) 语法,尤其是 if 语句。

I had used LALR(1) grammar for if statement我在 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.

Here, I had realized that i have to remove Left factoring.在这里,我意识到我必须删除左因子分解。

After that i couldn't solve epsilon production problem...之后我无法解决epsilon生产问题......

What is the LL(1) grammar for if-statement ? 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.

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