程序设计语言的单词都能用正规式来定义。请看下面两个例子:
外文教材中常常遇到的术语 - Token 单词,词标,符号 - lexeme 词素,词位 - pattern 模式,式样 这段话帮你理解外文教材中常常遇到的术语In general,there is a set of strings in the input for which the same token is produced as output. This set of strings is described by a rule called a pattern associated with the token. The pattern is said to match each string in the set. A lexeme is a sequence of characters in the source program that is matched by the pattern for a token. 例如: 源程序语句Const pi=3.14159,x1=10;中的pi和x1是token “identifier”的lexeme,其pattern为字母开头,后面跟有字母和/或数字的字符序列。 |