Mini Java编译器(三)
2008-01-05 09:12:57 来源:WEB开发网核心提示:三、属性翻译文法主类声明(MainClass)<MainClass> ::= "class" <Identifier>↑<id_name1>
三、属性翻译文法
主类声明(MainClass)
<MainClass> ::= "class" <Identifier>↑<id_name1>
@fillMemory↓<id_name1>↑<id_address>
@fillTable↓<id_name1>,<id_address>
@fillTree↓<id_name1>
"{" "public" "static" "void" "main" "(" "String" "[" "]"
<Identifier>↑<id_name2>,<id_belongsTo>=<id_name1>,<id_type>=StringArrayType
@fillTable↓<id_name2>,<id_belongsTo>
"{" <PRintStatement> "}" "}"
类声明(ClassDeclaration)
<ClassDeclaration> ::= "class" <Identifier>↑<id_name>
@checkTable↓<id_name>
@fillMemory↓<id_name1>↑<id_address>
@fillTable↓<id_name>,<id_address>
@fillTree↓<node_name>=<id_name>
"{" ( VarDeclaration )* ( MethodDeclaration )* "}"
类继续声明(ClassExtendsDeclaration)
<ClassExtendsDeclaration> ::= "class" <Identifier>↑<id_name1>
@checkTable↓<id_name1>
"extends" <Identifier>↑<id_name2>
@checkTree↓<id_name2>
@fillMemory↓<id_name1>↑<id_address>
@fillTable↓<id_name1>,<id_name2>,<id_address>
@fillTree↓<child_name>=<id_name1>,<parent_name>=<id_name2>
[]
赞助商链接