3. Considering the operator definition: You are given the following operators: +(int, int) int (plus) -(int, int) int (minus) &&(boolean, boolean) → boolean (and) ||(boolean, boolean) → boolean (or) == (int, int)→ boolean (equality) == (boolean, boolean)→ boolean (equality) . . name(input1_type, input2.type,...) → output_type . Note: Operator: +(int, int)→int, means it takes two integers, performs an add operation on them, and outputs an integer. Using the given operators, decide whether the following expressions ((a) to (e)) are typeable or not. If the expression is typeable (able to be reduced to a typed expression), give its type. and expected output. Otherwise, give an explanation of why it is not typeable. (a) True (b) 10+3 (c) 6-2.1 (d) (2-1) True (e) (4+5) -- (1+7)

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter2: Elements Of High-quality Programs
Section: Chapter Questions
Problem 5RQ
icon
Related questions
Question
3. Considering the operator definition:
You are given the following operators:
+(int, int) →int (plus)
-(int, int) int (minus)
.
.
.
.
name (input1_type, input2_type,...) → output_type
&&(boolean, boolean) → boolean (and)
(boolean, boolean) → boolean (or)
(int, int)→ boolean (equality)
(boolean, boolean) → boolean (equality)
==
. ==
Note: Operator: +(int, int)→int, means it takes two integers, performs an add operation
on them, and outputs an integer.
Using the given operators, decide whether the following expressions ((a) to (e)) are typeable
or not. If the expression is typeable (able to be reduced to a typed expression), give its type
and expected output. Otherwise, give an explanation of why it is not typeable.
(a) True
(b) 10+3
(c) 6-2.1
(d) (2-1) True
(e) (4+5)= (1+7)
Transcribed Image Text:3. Considering the operator definition: You are given the following operators: +(int, int) →int (plus) -(int, int) int (minus) . . . . name (input1_type, input2_type,...) → output_type &&(boolean, boolean) → boolean (and) (boolean, boolean) → boolean (or) (int, int)→ boolean (equality) (boolean, boolean) → boolean (equality) == . == Note: Operator: +(int, int)→int, means it takes two integers, performs an add operation on them, and outputs an integer. Using the given operators, decide whether the following expressions ((a) to (e)) are typeable or not. If the expression is typeable (able to be reduced to a typed expression), give its type and expected output. Otherwise, give an explanation of why it is not typeable. (a) True (b) 10+3 (c) 6-2.1 (d) (2-1) True (e) (4+5)= (1+7)
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Concept of Parenthesis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT