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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 11:30, kieraweems2034
Communication is the exchange of information. true false
Answers: 2
image
Computers and Technology, 23.06.2019 03:00, minelly1717
Your business be in google top rank. more the rank more the business leads. for best seo and digital marketing services be confident to contact you can get best seo solutions by assistance experts provide digital marketing, website development, seo expert services and social media internet seo expert services your branding solutions. seo expert services ,best seo expert services, online seo expert services,
Answers: 3
image
Computers and Technology, 25.06.2019 08:00, destineenikole175
Implement a document scanning function wordcountengine, which receives a string document and returns a list of all unique words in it and their number of occurrences, sorted by the number of occurrences in a descending order. if two or more words have the same count, they should be sorted according to their order in the original sentence. assume that all letters are in english alphabet. you function should be case-insensitive, so for instance, the words “perfect” and “perfect” should be considered the same word.
Answers: 1
image
Computers and Technology, 25.06.2019 16:00, Marliii363782
When entering new data into your table, which key should you press to move from one field or cell to the next?
Answers: 1
You know the right answer?
Using a programming language with which you are familiar and identify one of the semantic rules of t...

Questions in other subjects:

Konu
History, 11.03.2020 02:05