freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

編譯原理課程設(shè)計報告c-語言詞法與語法分析器的實現(xiàn)(編輯修改稿)

2024-10-01 09:21 本頁面
 

【文章內(nèi)容簡介】 p = newStmtNode(AssignK)。 p = t。 match(token)。 pchild[0] = expression()。 t = p。 } if (token == LPAREN ) { TreeNode * p = newStmtNode(CallK)。 p = t。 t=p。 match(token)。 pchild[0] = args()。 match(RPAREN)。 } break。 case LPAREN : match(LPAREN)。 t = expression()。 match(RPAREN)。 break。 default: syntaxError(unexpected token )。 printToken(token,tokenString)。 token = getToken()。 break。 } return t。 } TreeNode * args(void) { TreeNode * t = newStmtNode(ArgList)。 if(token != RPAREN) { tchild[0] = arg_list()。 return t。 }else return NULL。 } TreeNode * arg_list(void) { TreeNode * t = newStmtNode(ArgK)。 int i = 1。 if(token != RPAREN) tchild[0] = expression()。 while(token!=RPAREN) { match(DOT)。 tchild[i] = expression()。 i++。 } return t。 } TreeNode * parse(void) { TreeNode * t。 token = getToken()。 t =declaration_list()。 if (token!=ENDFILE) syntaxError(Code ends before file\n)。 return t。 } include include include /*對掃描的字符進(jìn)行匹配判斷 */ TokenType getToken(void) { /* index for storing into tokenString */ int tokenStringIndex = 0。 /* holds current token to be returned */ TokenType currentToken。 /* current state always begins at START */ StateType state = START。 /* flag to indicate save to tokenString */ int save。 while (state != DONE) { int c = getNextChar()。 save = TRUE。 switch (state) { case START: if (isdigit(c)) state = INNUM。 else if (isalpha(c)) state = INID。 else if (c == 39。=39。) state = INEQUAL。 else if (c == 39。39。) state = INLE。 else if (c == 39。39。) state = INME。 else if ((c == 39。 39。) || (c == 39。\t39。) || (c == 39。\n39。)) save = FALSE。 else if (c== 39。!39。) state = INNEQ。 else if (c == 39。/39。) { if(getNextChar()!=39。*39。) { ungetNextChar()。 state = DONE。 currentToken = OVER。 break。 } else { save = FALSE。 state = INCOMMENT。 } } else { state = DONE。 switch (c) { case EOF: save = FALSE。 currentToken = ENDFILE。 break。 case 39。+39。: currentToken = PLUS。 break。 case 39。39。: currentToken = MINUS。 break。 case 39。*39。: currentToken = TIMES。 break。 case 39。(39。: currentToken = LPAREN。 break。 case 39。)39。: currentToken = RPAREN。 break。 case 39。39。: currentToken = SEMI。 break。 case 39。[39。: currentToken=LZKH。 break。 case 39。]39。: currentToken=RZKH。 break。 case 39。{39。: currentToken=LDKH。 break。 case 39。}39。: currentToken=RDKH。 break。 case 39。,39。: currentToken=DOT。 break。 default: currentToken = ERROR。 break。 } } break。 case INCOMMENT: save = FALSE。 if (c == EOF) { state = DONE。 currentToken = ERROR。 } else if(c==39。*39。) { if(getNextChar()==39。/39。) { state = START。 } else { ungetNextChar()。 } } break。 case INNEQ: state=DONE。 if(c==39。=39。) currentToken=NEQ。 else { ungetNextChar()。 save=FALSE。 currentToken=ERROR。 } break。 case INEQUAL: state = DONE。 if (c == 39。=39。) currentToken = EQ。 else { /* backup in the input */ ungetNextChar()。 currentToken = ASSIGN。 } break。 case INNUM: if (!isdigit(c)) { /* backup in the input */ ungetNextChar()。 save = FALSE。 state = DONE。 currentToken = NUM。 } break。 case INID: if (!isalpha(c)) { /* backup in the input */ ungetNextChar()。 save = FALSE。 state = DONE。 currentToken = ID。 } break。 case INLE: state = DONE。 if(c== 39。=39。) currentTok
點擊復(fù)制文檔內(nèi)容
法律信息相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1