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 20:00
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
How to do this programming flowchart?
Answers: 3
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
English, 06.05.2020 02:21
question
Chemistry, 06.05.2020 02:21