Question
Anyone (a) Explain the scenario in which a strictness analyser is used to optimise a program. Your answer should consider the following: for what languages
Anyone (a) Explain the scenario in which a strictness analyser is used to optimise a program. Your answer should consider the following: for what languages strictness optimisation is useful, where it is beneficial to be able to place strict or non-strict annotations on a program (seeing the strictness analyser as a black-box oracle), and how such annotations can safely allow an optimiser to represent strict or non-strict values differently at run time. Give an example program which has different run-time space complexity before and after strictness optimisation. [5 marks] (b) One implementation for a strictness analyser determines strictness functions associated with each user-defined or built-in function. Given a user-defined function taking n integer arguments to an integer result, state the domain and range of its associated strictness function. How can such a strictness function be used to produce the strict or non-strict annotations in Part (a)? [3 marks] (c) Give a data structure suitable for representing strictness functions within a strictness analyser. Can ordinary functions be used? Would your data structure represent strictness functions ?(x, y, z). x?(y?z) and ?(x, y, z). (x?y)?(x?z) differently? Would these two strictness functions enable different strictness optimisations in Part (a)? [4 marks] (d) Give the strictness functions for the following source-language functions. (i) The built-in addition and 3-argument conditional functions. [2 marks] (ii) A built-in parallel-if function, which evaluates all its three arguments in parallel, and returns a result as soon as enough of its arguments terminate. This includes returning value v when the second and third arguments evaluate to v even if the first argument is still computing A car park payment system allows customers to select the number of hours to leave their car in the car park. The customer will get a discount if they enter their frequent parking number correctly. The system calculates and displays the amount the customer must pay. The price of parking, the number of hours the customer can enter, and any discount depend upon the day of the week and the arrival time. The number of hours entered is a whole number. The price per hour is calculated using the price in force at the arrival time. No parking is allowed between Midnight and 08:00. What other features would you use to address these limitations? Illustrate your suggestions with linguistic examples. [5 marks] (e) Discuss the evaluation of sentiment classification systems (a) Define the token game for basic Petri nets. [3 marks] (b) When is a basic Petri net safe from an initial marking?
START INPUT PointsWon, PointsLost IS Yes PointsWon = -1? END No Difference + PointsWon - PointsLost OUTPUT IS Yes "Well done Difference > = 1000 ? move up" No OUTPUT Yes IS "Sorry move DifferenceStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started