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

正文內(nèi)容

lexyacctutorial-免費閱讀

2024-11-19 00:55 上一頁面

下一頁面
  

【正文】 Declare a terminal symbol (token type name) that is leftassociative `%nonassoc39。/39。 } | ?? expr %prec UMINUS {$$ = $2。*39。(1) 1 – 2 3 (2) 1 – 2 * 3 PLLab, NTHU,Cs2403 Programming Languages 59 Precedence / Association %right ?=? %left 39。 * 39。 /* ignore white space */ Scanner PLLab, NTHU,Cs2403 Programming Languages 56 [AZaz][AZaz09]* { /* return symbol pointer */ = symlook(yytext)。39。 else $$ = $1 / $3。 term { $$ = $1 $3。 expression { $1value = $3。39。*39。 } float { return FLOAT。(39。 } | term { $$ = $1。(39。 } | term { $$ = $1。(39。 } | term { $$ = $1。(39。 } | term { $$ = $1。 factor : 39。)39。+39。 NUMBER { $$ = $1 $3。=39。 %} letter [azAZ] %% {letter}+ foo()。} pin {npin++。 PLLab, NTHU,Cs2403 Programming Languages 22 Transition Rules (cont?d) ? Four special options for actions: |, ECHO。 a operator: ASSIGNMENT b + c。PLLab, NTHU,Cs2403 Programming Languages 1 Lex Yacc tutorial KunYuan Hsieh Programming Language Lab., NTHU PLLab, NTHU,Cs2403 Programming Languages 2 Overview take a glance at Lex! PLLab, NTHU,Cs2403 Programming Languages 3 Compilation Sequence PLLab, NTHU,Cs2403 Programming Languages 4 What is Lex? ? The main job of a lexical analyzer (scanner) is to break up an input stream into more usable elements (tokens) a = b + c * d。 PLLab, NTHU,Cs2403 Programming Languages 21 Transition Rules ? regexp one or more blanks action (C code)。, BEGIN, and REJECT。 REJECT。 %% … void foo() { … } PLLab, NTHU,Cs2403 Programming Languages 28 User Subroutines Section (cont?d) ? The section where main() is placed %{ int counter = 0。 expression | expression { printf(= %d\n, $1)。 } | NUMBER { $$ = $1。 term | term。 | ID | NUM。(39。 } 。 expr 39。 } 。 expr 39。 } 。 expr 39。 } 。 expr 39。 } {id} { return ID。 factor | term 39。 factor | NUMBER | NAME PLLab, NTHU,Cs2403 Programming Languages 53 statement_list: statement 39。 } | expression { printf(= %g\n, $1)。 } | term 。 } | factor 。 factor { $$ = $2。 return NAME。 e x p r | e x p r 39。39。 39。 } %left 39。 %noassoc UMINUS PLLab, NTHU,Cs2403 Programming Languages 61 Shift/Reduce Conflicts ? shift/reduce conflict – occurs when a grammar is written in such a way that a decision between shifting and reducing can not be made. – ex: IFELSE ambigious. ? To resolve this conflict, yacc will choose to shift. PLLab, NTHU,Cs2403 Programming Languages 62 YACC Declaration Summary `%start39。 Declare a terminal symbol (token type name) that is nonassociative (using it in a way that would be associative is a syntax error, ex: x op. y op. z is syntax error) PLLab, NTHU,Cs2403 Programming Languages 64 Reference Books ? lex amp。 Declare a terminal symbol (token type name) that is rightassociative `%left39。 39。 else $$ = $1 / $3。? %left 39。 . . . 。 e x p r | e x p r 39。 } [ \t] 。 } | 39。 factor { if ($3 == ) yyerror(divide by zero)。39。=39。 | 39。 term | term term ::= term 39。 } char { return CHAR。 factor : 39。 term { $$ = $1 + $3。 factor : 39。 term { $$ = $1 + $3。 factor : 39。 term { $$ = $1 + $3。 factor : 39。 term { $$ = $1 + $3。 factor | factor
點擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1