问题描述
大家好,您能请我帮忙这个flex程序,因为我对flex环境不熟悉,问题是:
您必须制作一个flex文件,该文件应用于生成将与以下模式匹配的词法扫描器:
双:
它是一串没有任何间隙的字符,由三部分组成:
1.整数部分:它是一串数字(至少一位数字).它不能以0开头,除非字符串的值等于零,所以它只能由一位数字(0)组成.可以选择在字符串前面加上(+)或(-)符号.
2.小数部分:此部分是可选的;它以(.)开头,然后是一串数字(至少一位数字).
3.指数部分:这部分也是可选的,它以(e)或(E)开头,然后以(+)或(-)定义指数的符号,然后是一串数字(至少一位),字符串不能以(0)开头或等于(0).
.54E4、94.E34、09.45E3、00.43E5、4.53E,24.4E,34.3E0、34.3E09都不是双重的.
2.43E9、34E-9、0E + 24,-24.4,+ 90.000e + 34是双重的."
请帮助.
Hello every body could you plz Help me with this flex program because I am no familiar with flex environment the question is:
"You have to make a flex file, this file should be used to generate a lexical scanner that will match the following patterns:
DOUBLE:
It''s a string of characters without any gaps, it consists of three parts:
1. Integer part: It''s a string of digits (at least one digit). It mustn’t begin with 0 except if the value of the string equal to zero so it has to consist of only one digit (0). Optionally the string can be preceded by (+) or (-) sign.
2. Fractional part: this part is optional; it begins with (.), then a string of digits (at least one digit).
3. Exponential part: this part is also optional, it begins with (e) or (E) then (+) or (-) to define the sign of the exponential, then a string of digits (at least one digit), this string mustn’t begin with (0) or equal to (0).
.54E4, 94.E34, 09.45E3, 00.43E5, 4.53E, 24.4E, 34.3E0, 34.3E09 are not DOUBLE.
2.43E9, 34E-9, 0E+24, -24.4, +90.000e+34 are DOUBLE."
plz help.
推荐答案
这篇关于请帮我这个弹性程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!