CS 3361 | Fall 2020 | Assignment #3 Lexical Analyzer
Develop the C or C++ source code required to solve the following problem.
Develop a lexical analyzer in C or C++ that can identify lexemes and tokens found in a source code file provided by the user. Once the analyzer has identified the lexemes of the language and matched them to a token group, the program should print each lexeme / token pair to the screen.
The source code file provided by the user will be written in a new programming language called DanC and is based upon the following grammar (in BNF):
P ::= S S ::= V:=E | read(V) | write(V) | while C do S od | S;S C ::= E < E | E E | E = E | E < E | E <= E | E = E E ::= T | E + T | E - T T ::= F | T * F | T / F F ::= (E) | N | V V ::= a | b | | y | z | aV | bV | | yV | zV N ::= 0 | 1 | | 8 | 9 | 0N | 1N | | 8N | 9N Your analyzer should accept the source code file as a required command line argument and display an appropriate error message if the argument is not provided or the file does not exist. The command to run your application will look something like this: Form: danc_analyzer
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.Read more
Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.Read more
Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.Read more
Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.Read more
By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.Read more