家庭作业-忽略:[构建扫描仪] [英] HOMEWORK - Ignore: [Building a Scanner]

查看:101
本文介绍了家庭作业-忽略:[构建扫描仪]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您必须为以下标记集设计和实现词法分析器/扫描器.
–无符号整数常量
–电子格式iiiii.fffffeSEE
的无符号浮点常量 其中,至少有一个整数(可以为零),最多五个小数位数,"e"是指数,S是指数的符号,"+"或-" (缺少S表示"+"),指数的一位或两位数(以10为底).模式{eSEE}是可选的.
–标识符:字母,后跟字母,数字或下划线
–保留字-{array,begin,const,do,else,end,for,func,if,proc,prog,repeat,set,然后,to,直到var}
–类型-{int,float,bool}
–运算符-{:=,+,-,*,/,div,mod,< ;,< =,> ;,> =,=,<>}}
–分隔符-{(),[]; ..: }
•您的扫描仪应尽可能长地匹配,例如字符串
"< ="将被标识为小于等号",而不是<"(小于")和"="(等于")

You have to design and implement a lexical analyzer/scanner for the following set of tokens.
– Unsigned integer constant
– Unsigned floating point constant in e-format iiiii.fffffeSEE
where ,There is at least one integral digit (may be zero), at most five fraction digits, ''e'' is for the exponent, S is the sign of the exponent, ''+'' or ''-'' (absence of S indicates a ''+''), one or two digit of exponent (base 10). The pattern {eSEE} is optional.
– Identifier: letter followed by letters, digits or underscore
– Reserved words - {array, begin, const, do, else, end, for, func, if, proc, prog, repeat, set, then, to, until, var}
– Types - {int, float, bool}
– Operators - {:=, +, -, *, /, div, mod, <, <=, >, >=, =, <>}
– Delimiters - { ( ) , [ ] ; .. : . }
• Your scanner should go for longest possible match i.e. a string
''<='' is to be identified as ''less-equal'' and not as ''<'' (''less'') and ''=''(''equal'')

推荐答案

确定-因此,您无需编辑帖子,而是创建了一个新帖子.现在很明显,您的任务是家庭作业.所以,如果您愿意,我会为您做功课.对于
OK - so instead of editing your post, you created a new one. And now it''s clear that your task is homework. So, if you like, I will do your homework for you. For


50.然后,当您不知道如何进行下一次作业时,价格就会翻倍.等等.除非您有钱而且不在乎您是否学到任何东西,否则对我来说,您的选择似乎是自己做作业,或者现在就去麦当劳求职并节省时间.

我无法想象如果不先学习达到此水平所需的东西,就会有人进行这项家庭作业.到目前为止,您是否使用Google作弊?显然,您的老师认为您拥有所有必要的信息,至少可以尝试这样做,并且确实存在这样的站点来尝试帮助愿意尝试做自己的工作的人,因此,如果您真的不知道该怎么做,那么您可能会老师是您应该和之交谈的人.
50. Then, when you have no idea how to do your next homework, the price doubles. And so on. Unless you are rich AND don''t care if you learn anything or not, your options to me appear to be to do your own homework, or just apply for a job at McDonalds now and save time.

I can''t imagine that someone would be given this homework without first learning the things required to get to this level. Did you use google to cheat up to now, or what ? Your teacher obviously thinks that you have all the information you need to at least attempt this, and sites like this do exist to try to help people who are willing to try to do their own work, so perhaps if you really have no clue, your teacher is the one you should be talking to.


这篇关于家庭作业-忽略:[构建扫描仪]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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