Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the simple calculator (Syntax: slide 16; textbook: p.54), give an example of input code that produces exactly three errors from the scanner. The scanner
Given the simple calculator (Syntax: slide 16; textbook: p.54), give an example of input code that produces exactly three errors from the scanner. The scanner encounters an error when reading an invalid token. When that happens, assume that the scanner skips everything until the next white space (\ ,\t, ). Your three invalid tokens should start with three different characters. Your input code will be a string over the alphabet {a,b,...,z,0,1,...,9,:,=,+,-,*,/,(,),\ ,\t, }. Explain in detail how the three errors are produced from the scanner.
. Example: simple calculator language ++ assign (Algol style; C has =') plus minus + - times * div Iparen ( rparen ) id - letter (letter | digit )* (except for read and write) number digit digit* | digit* ( . digit | digit . ) digit* comment /* ( non-* | * non-/ )* *+/ 177 (non-newline)* newline 16 . Example: simple calculator language ++ assign (Algol style; C has =') plus minus + - times * div Iparen ( rparen ) id - letter (letter | digit )* (except for read and write) number digit digit* | digit* ( . digit | digit . ) digit* comment /* ( non-* | * non-/ )* *+/ 177 (non-newline)* newline 16Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started