Click here to Skip to main content
16,017,200 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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')
Posted
Updated 13-Dec-09 18:54pm
v4

1 solution

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. 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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900