请帮我这个弹性程序 [英] Plz help me with this flex program

查看:122
本文介绍了请帮我这个弹性程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,您能请我帮忙这个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.

推荐答案

我们不做作业:它的设置是有原因的.在这里,您可以考虑自己被告知的内容,并尝试理解它.也可以在那里帮助您的导师识别您的弱点,并将更多的注意力放在补救措施上.

自己尝试,您可能会发现它并不像您想的那么困难!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!


这篇关于请帮我这个弹性程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆