CMSC 430 University of Maryland Programming Discussion

Provide a program in the target language(cygwin)of our compiler/interpreter that incorporates all elements of the language. It must include all of the following:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
  • Integer, Real and Boolean literals
  • Every arithmetic operator: + – * / rem **
  • Every relational operator: = /= > >= < <=
  • Every logical operator: and or not
  • An if statement
  • A case statement
  • A reduce statement
  • Multiple variable declarations
  • Multiple parameter declarations

In addition, your program should be written in a such a way that it test the associativity and precedence of all operators. It should also include nested statements.

Also provide several sets of input (values for the parameters) to the program, enough so that every line of code within the program is executed at least once. For each input supplied, provide the corresponding output.

This is the professors example. As you can see it compiles successfully and will need an input as a test case for the test compiler. Please use the test compiler and the files in the zip attached to do this. This is the target language that the question is asking for. Please do an original answer and don’t take from another website. Please do it from scratch. Thank you so much for the help.

Example:

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

function main age: integer, salary: real, isMeaningful: boolean, commuteTime: integer, isNotFun: boolean, hasLotsOfWorkFriends: boolean returns real;

ageRanking: real is

if age <= 35 and age /= 0 and age > 18 and age < 100 then

0.5 * 100 / age * 100 ** 2;

else

if age >= 65 then

2.0 * 100 / age * 100 ** 2;

else

1.25 * 100 / age * 100 ** 2;

endif;

endif;

commuteRanking: integer is

case commuteTime is

when 1 => 3 – commuteTime;

when 2 => 2 – commuteTime;

when 3 => 1 – commuteTime;

others => 0 – commuteTime;

endcase;

satisfactionRanking: real is

if not isNotFun and isMeaningful and hasLotsOfWorkFriends then

100;

else

0;

endif;

salaryRanking: real is

reduce +

salary;

(0.2 * salary);

12000;

endreduce;

booleanFun: boolean is

isMeaningful and ( 1 <= 2 or 2 >= 3 or not 5 > 2 * 1 rem 1 + 4 ** 4 – 2 / 2 or 3 /= 4 and not 4 < 3 or 5 = 1 * 2 + 3 - 5 / 5 rem 2 ** 4);

begin

if booleanFun then

(salaryRanking / 1000 + ageRanking / 10000 + commuteRanking * 10 + satisfactionRanking ) / 10;

else

0;

endif;

end;

Still stressed from student homework?
Get quality assistance from academic writers!

Order your essay today and save 25% with the discount code LAVENDER