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

正文內(nèi)容

編譯原理-詞法分析-文庫吧資料

2024-12-14 11:47本頁面
  

【正文】 a, aa, aaa, aaaa, … ? L(r*) = L(r)* ? Example: L((a|bc)*) = L(a|bc)* = {a, bb}* ={ε, a, bb, aa, abb, bbbb, aaa, aabb, abba, abbbb, bbabb, bbbba, bbbbbb,…} Precedence of Operations ? Repetition ? Concatenation ? Alternative ? Example: a|cb* is interpreted as a|(c(b*)) ? Parentheses are used to indicate the precedence as usual. Highest Lowest Names for Regular Expressions ? Often,it is helpful to use regular definitions of names. ? Example: digit=0|1|2…|9 ? The name bees a metasymbol and should be distinguished from the string (digit in the example). ? We can use names in regular expressions like digit digit* Example ? Σ = {a, b, c} ? Find a regular expression for the strings of Σ that contain exactly one b. ? (a|c)*b(a|c)* ? b does not have to be a center of a matched string. Example ? Σ = {a, b, c} ? Find a regular expression for the strings of Σ that contain at most one b. ? We can use a solution to the previous example and add another case matching the strings with no b. (a|c)*|(a|c)*b(a|c)* A|B A: no b B : Just only one b ? Another solution: (a|c)*(b|ε)(a|c)* (Its structure is similar to ) Example ? Σ = {a, b} ? Consider a set of strings consisting of a single b surrounded by the same number of a?s. S = {b, aba, aabaa, aaabaaa, …} ? Regular expression a*ba* does not work. ? This set of strings cannot be described by a regular expression. ? This can be proved using a famous theorem called the pumping lemma. Example ? Σ = {a, b, c} ? Determine a description of a language generated by ((b|c)*a(b|c)*a)*(b|c) ? This generates the language if strings containing an even number of a?s. ? ( Pay more attention to a special element ) Extensions to Regular Expressions One or more repetitions r r* = r+ Any character . Alternatives [09] [abc] Any character not in a given set ~(a|b|c) [^abc] Optional subexpression ? natural = [09] signedNatural = (+|)? Natural Extension Regular Expressions for Numbers nat = [09]+ signedNat = (+|)? nat number = signedNat (“.” nat)?(E signedNat)? ? “ “ are escape characters. They turn off the special meaning of metacharacters Comments ? Comments are ignored during scanning process. ? A scanner must recognize ments and discard them. ? There may be no explicit token for ments – pseudotoken. ? {Pascal ment} {(~})*} ? Ada ment (~newline)* Reserved Words and Identifiers reserved = if | while | do | … letter = [azAz] digit = [09] identifier = letter(letter|digit)* Token Delimiters ? Token delimiters are characters that imply that a longer string cannot represent a token. – xtemp=ytemp。 } TokenRecord。 char * stringval。, etc. 3. Numbers and identifiers: , myName, myGrade, etc. 4. Literals: “Hello, world!”, ?a?, ?b?, etc. ? Tokens are usually defined as an enumerated type typedef enum {IF, THEN, ELSE, PLUS, MINUS, NUM, ID,…} TokenType。Chapter 2 Scanning Instructor Jianhui Yue Software College SCU Introduction ? The scanning, or lexical analysis phase, reads the source program as a stream of characters and divides them into tokens. ? This is a special case of pattern matching – Need to study methods of pattern specification and recognition ? Regular expressions ? Finite automata ? The scanner must operate as efficiently as possible. Introduction (cont ) Scanner Parser Semantic Analyzer Source Code Optimizer Code Generator Target Code Optimizer Source Code Target Code Tokens Syntax Tree Intermediate code Target Code Literal Table Symbol Table Error Handler Tokens ? Logical units that the scanner generates. ? Example: a[index] = 4 + 2。 a identifier
點(diǎn)擊復(fù)制文檔內(nèi)容
教學(xué)課件相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1