Java虚拟机的说明书.docx
renewcommandsectionnamePftA1phsectionXrenewcommandXsectionformatflushleft)Xsetcountersection0%newpage%appendix'section语法图beginfigurehtpbXincludegraphicsDiasProgram)caption主程序endfigurebeginfigurehtpbXincludegraphicsDiasConstantsDeclcaption定义常量endfigure)beginfigurehtpbincludegraphicsDias/ConstantDecl)caption定义一个常量endfigurebeginfigurehtpbXincludegraphicsDiasVarsDeclcaption变量定义)endfigure)beginfigurehtpbXincludegraphicsDiasVarsDeclOneType)caption卜一种类型变量定义endfigurebeginfigurehtpbXincludegraphicsDiasVar1.istcaption变量列表endfigure)beginfigurehtpbinc1udegraphicsDiasType)caption类型endfigurebeginfigurehtpbXincludegraphicsDiasProcsDeclcaption过程/函数定义endfigure)beginfigurehtpbincludegraphicsDias/ProcedurcDec1)caption过程定义endfigurebeginfigure)htpbincludegraphicsDias/FunctionDecl)caption函数定义endfigure)beginfigurehtpbXincludegraphics(DiasZStatementBlock)caption语句块endfigurebeginfigurehtpbXincludegraphicsDiasFnctionCallcaption函数调用XincludegraphicsDiasIfStatement)captiontextttif语句endfigure)beginfigurehtpbXincludegraphicsDiasWhiIeStatement)captiontextttwhile语句endfigurebeginfigurehtpbincludegraphicsDiasForStatemcnt)captiontextttfor语句endfigure)beginfigurehtpbXincludegraphicsDiasNewarraycaptiontextttNewarray)语句endfigurebeginfigurehtpbXincludegraphicsDiasRetUrnStatement)captiontextttreturn)语句endfigure)beginfigure)htpbXincludegraphicsDiasSystemCall)caption系统调用endfigure)beginfigure)htpbincludegraphicsDias/Statement)caption语句)endfigure)newpagesection属性翻译文法)先阅读时请参阅用BNF描述的JP1.z语法bcgintabularhtbpccccclhline语法成分&属性&来自&类型&语义动作&位置hline主程序&程序名&标识符&综合&填入全局表&标识符之后Wcline2-6&主代码&语句块&综合&填入全局表&语句块之后hline常量定义)&名称&标识符&综合&填入全局表&识别出字面cline2_4&类型&Type&综合&&量之后cline2-4&值&1.iteral&综合&&hline变量定义&变量数量&一类变量定义&综合&根据是否全局)&全部识别完后W&&相加&&填符号表&OWcline2-4&各变量&一类变量定义&综合&&)W&含类型&&&&Wcline2-4&是否全局&上层结构&继承&&Whline一类变量&变量列表&(Var1.ist)&综合&&(cline(2-4定义&类型&Type&综合&&hline变量列表&变量名列表&标识符&综合&&Whline多个过程&代码&一个过程定义&综合&完成代码&识别出一个&&&&&过程定义之后hline过程定义&名称&标识符&综合&填全局表&识别出右括号后Wcline2-4&参数&前一个变量定义&综合&&Wcline26)&参数个数&前一个变量定义&综合&续填全局表&识别出后一个cline2-4)&本地变量&后一个变量定义&综合&&变量定义之后Wcline2-4&本地变量个数&两个变量定义&综合&&&&变量数量之和&&&cline2-6&代码&语句块&综合&填表&识别出语句块后hline函数定义&名称&标识符&综合&填全局表&识别出类型后Wcline2_4&参数&前一个变量定义&综合&&Wcline2-4&参数个数&前一个变量定义&综合&1&cline(2-4&返回值类型&Type&综合&&cline2-6)&本地变量&后一个变量定义&综合&续填全局表&识别出后一个Wcline2_4&本地变量个数&两个变量定义&综合&&变量定义之后&&变量数量之和&&&Wcline(2-6&代码&语句块&综合&填表&识别出语句块后hline语句块&代码&语句&综合&&hline语句&代码&下层结构&综合&&W&&表达式、子语句&&&W&&textttifwhilefor语句&&&)&&是由它们的子&&&W&&语句拼装起来的。&&&Whline表达式&代码&分析过程&综合&&Whlineendtabular)section错误信息表bcgindescription)itemtextttNeeda在处理赋值时,没有发现':='';)itemtextttTypeConfliCt.某项类型检查没有通过;!itemtextttUsearraywithindex.在赋值语句中,发现数组没有下标;itemtextttIthinkyouwantdeclareaconst,butwhat,sitname?在应当出现常量定义时,没有发现标识符;itemtextttYoushoulduse,=,insteds'.试图用赋值号定义常量;这个错误不会导致跳过;itemtextttYoushoulduse'='.在常量定义中,没有发现等号或赋值号;)itemtextttThisisnotatypei'veeverknown:XXXXXX不是一个类型名称;itcmtextttifthereisno'Idon'tknowwhatyouwanttodo.在常量定义中没有发现冒号;itemtextttifitISaconst,declareitbefore:XXXXXX这个标识符不是预先定义过的常量;)itemtextttIwantaliteral,notaTYPE等号后的不是标识符,也不是字面量;itemtexttt1thinkyourconstantdecishouldbeendhere.常量定义不正确的结束;itemtexttttypenotsame:wantTYPElfound:TYPE2欲定义常量的值与刚才声名的不同,应为TYPEl,实为TYPE2;itemtextttWehaveaNAMEalready.名字冲突;itemtextttXXXisnotaConStand.欲用一个非常量的标识符给常量定义。在约定先定义常量后,这个信息已不可能出现;itemtextttConstsDeclendincorrectly.全部常量定义不正确的结束;itemtextttNeedFilCnamC.(没有在命令行给出欲编译的文件名;itemtextttUnknownargument:XXXXXX不是合法的参数。目前只有textttdebug可以作为合法的参数。itemtextttExpressionfailed.(表达式处理失败。这将导致编译过程中止;)itemtextttArrayindexmuststartWith''在表达式中使用数组而不带下标;)itemtextttIndexmustbeinteger.数组下标不是整数;itemtextttIndexmustbeendWith''下标应以''''结束itemtextttTheremustbeaintegerorfloatexpression.在FOr循环中循环变量应该是整型、初值、终值应该是整型或符点型f。UlOte一般情况下,将符点型表达式赋值给整形变量是不被允许的,但在For语句中符点型的循环初值与终值会自动转换成整型;itemtextttForstatementneedanIntegerVariabIe.循环变量必须是整型'footnote不能是数组元素;itemtextttNotavalidnameofafunction.函数名不合法;将为它指定一个texttt*nothisProCedUre*的名字使分析继续;itemtextttIcannotsee