Mini Java编译器(二)__教程 |
|
日期:2007-5-20 1:28:18 人气:115 [大 中 小] |
|
|
|
::=
"if" "(" Expression ")" Statement "else" Statement
WhileStatement
::=
"while" "(" Expression ")" Statement
PrintStatement
::=
"System.out.println" "(" Expression ")" ";"
Expression
::=
AndExpression
|
CompareExpression
|
PlusExpression
|
MinusExpression
|
TimesExpression
|
ArrayLookup
|
ArrayLength
|
MessageSend
|
PrimaryExpression
AndExpression
::=
PrimaryExpression "&&" PrimaryExpression
CompareExpression
::=
PrimaryExpression "<" PrimaryExpression
PlusExpression
::=
PrimaryExpression "+" PrimaryExpression
MinusExpression
::=
PrimaryExpression "-" PrimaryExpression
TimesExpression
::=
PrimaryExpression "*" PrimaryExpression
ArrayLookup
::=
PrimaryExpression "[" PrimaryExpression "]"
ArrayLength
::=
PrimaryExpression "." "length"
MessageSend
::=
PrimaryExpression "." Identifier "(" ( ExpressionList )? ")"
ExpressionList
::=
Expression ( ExpressionRest )*
ExpressionRest
::=
"," Expression
PrimaryExpression
::=
IntegerLiteral
|
TrueLiteral
|
FalseLiteral
|
Identifier
|
ThisExpression
|
ArrayAllocationExpression
|
AllocationExpression
|
|
|
出处:本站原创 作者:佚名 |
|
|