三、属性翻译文法 主类声明(MainClass) ::= "class" ↑
@fillMemory↓↑
@fillTable↓,
@fillTree↓
"{" "public" "static" "void" "main" "(" "String" "[" "]"
↑,=,=StringArrayType
@fillTable↓,
"{" "}" "}"
类声明(ClassDeclaration) ::= "class" ↑
@checkTable↓
@fillMemory↓↑
@fillTable↓,
@fillTree↓=
"{" ( VarDeclaration )* ( MethodDeclaration )* "}"
类继承声明(ClassExtendsDeclaration) ::= "class" ↑
@checkTable↓
"extends" ↑
@checkTree↓
@fillMemory↓↑
@fillTable↓,,
@fillTree↓=,=
"{" ( VarDeclaration )* ( MethodDeclaration )* "}"
变量声明(VarDeclaration) ::= ↑
↑, “;”
@checkTable↓,
@fillMemory↓↑
@fillTable↓,,,
↑ ::= ↑=ArrayType
|↑=BooleanType
|↑=IntegerType
::= ↑=ObjectType
@checkTable↓
↑, “;”
@checkTable↓,
@fillTable↓,,
方法声明(MethodDeclaration) ::= "public" ↑
↑,
@checkTable↓,
@fillMemory↓↑
@fillTable↓,,,
"(" ( )? ")"
"{" ( )* ( )* "return"
↑,
@checkType↓, ";" "}"
↑ ::= ↑=ArrayType
|↑=BooleanType
|↑=IntegerType
::=
( )*
::= ↑
|