subject

Using a programming language with which you are familiar and identify one of the semantic rules of that language. Construct an example of a program in that language that violates that rule. Post a screenshot showing the error message that the compiler for that language would generate for your program example. Review the requirements of the attachment. Select one of the semantic errors that you are to detect in the attachment and provide a test case that will detect it.
The fourth project involves modifying the semantic analyzer for the attached compiler by adding checks for semantic errors. The static semantic rules of this language are the following: Variables and parameter names have local scope. The scope rules require that all names be declared and prohibit duplicate names within the same scope. The type correspondence rules are as follows:
• Boolean expressions cannot be used with arithmetic or relational operators. • Arithmetic expressions cannot be used with logical operators.
Reductions can only contain numeric types.
Only integer operands can be used with the remainder operator.
The two statements in an if statement must match in type. No coercion is performed.
All the statements in a case statement must match in type. No coercion is performed.
The type of the if expression must be Boolean.
The type of the case expression must be Integer
A narrowing variable initialization or function return occurs when a real value is being forced into integer. Widening is permitted.
Boolean types cannot be mixed with numeric types in variable initializations or function returns. Type coercion from an integer to a real type is performed within arithmetic expressions.
You must make the following semantic checks.
Those highlighted in yellow are already performed by the code that you have been provided, although you are must make minor modifications to account for the addition of real types and the need to perform type coercion and to handle the additional arithmetic and logical operators.
Using Boolean Expressions with Arithmetic Operator
Using Boolean Expressions with Relational Operator
Using Arithmetic Expressions with Logical Operator Reductions containing nonnumeric types Remainder Operator Requires Integer Operands
If-Then Type Mismatch Case Types Mismatch
If Condition Not Boolean
Case Expression Not Integer
Narrowing Variable Initialization
Variable Initialization Mismatch
Undeclared Variable Duplicate Variable Narrowing Function Return

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:40
How do i get the most points, without any effort?
Answers: 2
question
Computers and Technology, 23.06.2019 01:00
Petrică, tânăr licean în clasa a ix-a, a primit în dar de la părinţii săi un cont bancar pentru micile sale cheltuieli curente. el este pasionat de internet banking şi îşi verifică cu grijă toate tranzacţiile efectuate. pentru creşterea securităţii tranzacţiilor online, banca îi furnizează lui petrică un număr pe care el va trebui să îl modifice, obţinând un număr tan – număr de autentificare a tranzacţiei (transaction authentication number). regula de obţinere a numărului tan este următoarea: se formează cel mai mic număr par din toate cifrele numărului furnizat de bancă. cerinţă cunoscând numărul n furnizat de bancă, să se determine numărul tan obţinut de petrică. date de intrare fişierul tan.in conţine pe prima linie numărul natural n cu semnificaţia din enunţ. date de ieşire fişierul de ieşire tan.out va conţine o singură linie pe care va fi scris numărul tan cerut. restricţii • 0 < n < 18*1018 • n are cel puţin o cifră pară • numărul tan obţinut nu poate conţine zerouri nesemnificative
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
question
Computers and Technology, 23.06.2019 14:00
Select the correct answer. andre was recently hired by an organization to check for system vulnerabilities. he is supposed to exploit these vulnerabilities and create a report on the extent of damage to which the system was susceptible. what position does andre hold in this organization? a. information security analyst b. information assurance manager c. penetration tester d. network security engineer e. chief information security officer
Answers: 2
You know the right answer?
Using a programming language with which you are familiar and identify one of the semantic rules of t...
Questions
question
Mathematics, 15.05.2021 06:00
question
Mathematics, 15.05.2021 06:00
question
Chemistry, 15.05.2021 06:00
question
Mathematics, 15.05.2021 06:00
question
Mathematics, 15.05.2021 06:00
Questions on the website: 13722363