rllparser.txt
来自「一个用C++写的编译器」· 文本 代码 · 共 535 行 · 第 1/2 页
TXT
535 行
Program ->CompoundStmt
CompoundStmt ->{ Stmts }
{
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->Stmt Stmts
Stmt ->WhileStmt
WhileStmt ->while ( BoolExpr ) Stmt
while
(
BoolExpr ->ArithExpr BoolOp ArithExpr
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
BoolOp ->>
>
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
)
Stmt ->CompoundStmt
CompoundStmt ->{ Stmts }
{
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->+ MulExpr ArithExprPrime
+
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->- MulExpr ArithExprPrime
-
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->ε
ε
}
Stmts ->Stmt Stmts
Stmt ->IfStmt
IfStmt ->if ( BoolExpr ) then Stmt else Stmt
if
(
BoolExpr ->ArithExpr BoolOp ArithExpr
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
BoolOp ->>=
>=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
)
then
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->+ MulExpr ArithExprPrime
+
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
else
Stmt ->CompoundStmt
CompoundStmt ->{ Stmts }
{
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->* SimpleExpr MulExprPrime
*
SimpleExpr ->( ArithExpr )
(
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->+ MulExpr ArithExprPrime
+
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->num
num
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
)
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->Stmt Stmts
Stmt ->AssigStmt
AssigStmt ->id = ArithExpr ;
id
=
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->+ MulExpr ArithExprPrime
+
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
;
Stmts ->ε
ε
}
Stmts ->Stmt Stmts
Stmt ->IfStmt
IfStmt ->if ( BoolExpr ) then Stmt else Stmt
if
(
BoolExpr ->ArithExpr BoolOp ArithExpr
ArithExpr ->MulExpr ArithExprPrime
MulExpr ->SimpleExpr MulExprPrime
SimpleExpr ->id
id
MulExprPrime ->ε
ε
ArithExprPrime ->ε
ε
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?