Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedGiven 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 16

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Solaris 11.2 System Administration (oracle Press)

Authors: Harry Foxwell

1st Edition

007184421X, 9780071844215

More Books

Students also viewed these Databases questions

Question

What is conservative approach ?

Answered: 1 week ago