Question: Consider the example grammar we used in the Week 5 Hands-On: 1. (2 points) Single character identifiers are no longer allowed! Replace the current sid>

Consider the example grammar we used in the Week 5 Hands-On: 1. (2 points) Single character identifiers are no longer allowed! Replace the current sid> production with one or more different rules that will support the following kinds of NEW identifiers: Integer variable names start with $followed by 1 or 2 additional characters, the first of which must be a lower case letter, the second of which can be a lower case letter or a digit. For example, $a1 and $z are both valid integer variable names. Float variable names start with # followed by 1 or 2 additional characters, the first of which must be a lower case letter, the second of which can be a lower case letter or a digit. For example, #b and #x0 are both valid float variable names. 2, (1 point) Modify the > productions to also allow for the arithmetic operations-and/ 3. (2 points) Give 3 examples of valid expressions in your new grammar, one of which is at least 6 characters long. 4. (2 points) For ONE of your valid expressions that is at least 6 characters long, show its derivation and draw its parse tree. 5. (2 points) Give 3 examples of invalid expressions in your new grammar. In EACH CASE, state in your own words WHY it is invalid. 6.(20 points) Write a lexical analyzer (scanner) for this new BNE in a programming language of your choice Given an input expression, this scanner should output a list of lexemes and tokens, one per line. If something is wrong" in the input stream, you must try to recover" and push on as best you can through the scan
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
