All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Ask a Question
Search
Search
Sign In
Register
study help
computer science
an experiential introduction to principles of programming languages
Questions and Answers of
An Experiential Introduction To Principles Of Programming Languages
Modify the call-by-name Funclang interpreter to implement the call-by-need parameter passing strategy discussed previously.
Extend the syntax and semantics of the Funclang language to add support for the logical conjunction (and) and logical disjunction (or) expressions.
Extend the syntax and semantics of the Funclang language to add support for a switch expression.
In some programming languages such as Scheme, pairs are the basic values and lists are defined in terms of pairs. Define a pair as a 2-tuple and redefine the value relations for list, car, cdr, cons,
Extend the Funclang language to support a new expression equal?, which takes two subexpressions and returns #t if their values are equal and #f otherwise.The following interaction log illustrates the
Extend the Funclang programming language to support a new list comprehension expression. A list comprehension is a concise way of representing higher-order functions that operate over a list. It
Design and implement Heap, a new abstraction representing area in the memory reserved for dynamic memory allocation. For testing, you can assume the capacity of the heap to be 8 KB.The heap
Create an example allocation and deallocation test case for heap, which allocates n chunks of memory of size s, where n is size/s. Here, size is the capacity of the heap. The test case then frees
Extend the heap abstraction with three operations: allocArray, getAt, and setAt, which allows for treating a chunk of memory as a two-dimensional array. Given the row and column sizes, allocArray
Allocate a chunk of memory of size 16 cells containing the consecutive natural numbers 1–16 using the alloc and set operations provided by the heap abstraction. Then treat this chunk of memory as a
Extend the Funclang language to add array of numeric values as a new kind of value to the programming language. This would require adding three new kinds of expressions, arrayexp, indexexp, and
The goal of this question is to understand the semantics of the Reflang expressions. Perform the following operations on your implementation of Reflang and explain the output.
Write three Reflang programs that use aliases. Recall that an alias is created when two variables refer to the same memory location.
Modify the Reflang language so that the locations 0, 1, and 2 are treated specially as standard input, standard output, and standard error, respectively. Take the following steps to implement this
Modify the semantics of Reflang to implement a heap abstraction that implements versions of a heap. In a versioned heap, writing to an existing memory location does not overwrite the old value;
This problem is about references and aliasing. In Reflang, an expression like the following creates two aliases (class and course) to the memory cell storing the value 342:Modify the Reflang
This question is about a semantic variation of the heap abstraction.A typed heap enforces the property that in a memory location, only values of compatible types can be stored. Two types are
This question is about a semantic variation of reference-related expressions. A hot heap location is one that is accessed more often by a program.Extend Reflang to support hot store locations. The
This problem is about memory deallocation. In Reflang, the free expression deallocates memory. The current semantics of free expression is permissive, in that it allows a memory location to be
This problem is about explicit references. In current realization of the Reflang language, arithmetic operations are not permitted on a reference value.1. Modify the semantics of a dereference
This problem is about explicit references.1. In the previous problem, we enhanced the Reflang language to allow reference arithmetic. Add a new predicate expression, rarith?, to check if an
This problem is about reachability, which is an important concept for automatic memory management. Given a name, the set of reachable memory locations includes those that can be accessed directly or
Our concurrency model includes facilities for creating a collection of tasks and mutually exclusive access to memory locations.These facilities can be used to model synchronization between two tasks,
Extend the fork expression in the language of this chapter to be able to create two or more concurrent tasks, instead of exactly two concurrent tasks.
In the Forklang language, it is possible for a task to access a memory location without acquiring a lock first. This makes it possible for a task to introduce errors in the execution of another task,
The following problems relate to data races in Forklang programs.1. Write a Forklang function that creates a location in the heap, stores an empty list at that location, and assigns the name
The following problems are about deadlocks in Forklang programs:1. Write a Forklang function that creates three references and assigns them the name ‘a’, ‘b’, and ‘c’. After creating
Forklang supports the locking and unlocking of locks to synchronize accesses (read and write) to memory.Languages like Java provide higher-level synchronization mechanisms such as synchronized
Our realization of the Forklang language maintained a shared heap. Those program expressions that assess heap directly manipulated this shared heap. This design had the advantage that it avoided
Our realization of the Forklang language creates two threads. In some programming languages, fork creates a separate process (i.e., the forked task and the original task do not share memory). In
Write five examples of well-typed and ill-typed programs that use all the arithmetic expressions.
For some expressions such as (/ x 0), where 0 appears as an immediate subexpression, it is easy to check for and eliminate divide-by-zero errors. Enhance the typechecking rule for the division
More practice with types in Typelang:1. Check this let expression, explain why it is well typed, and write its type.2. Check this let expression, explain why it is well typed, and write its type.3.
Explain the following typechecking errors in Typelang programs: 1. Check this let expression, explain why it is ill typed, and specify the typechecking rule that will detect the error.What did the
Write a specification for the sumcubes function, as shown here:
Write a specification for the function find shown here:
Write a more detailed specification for the function append shown here, which uses specification cases to make four separate instances of the function explicit in the specification:when lst1 is empty
When writing specifications, it is helpful to have access to the values of the variables in the precondition state (i.e., when the function body has not run). In some specification languages, the
Invariants are conditions that hold throughout a computation. Invariants are useful for specifying data structures since there are certain constraints that must always hold for the data structure.
It is often desirable to make assertions about the set of memory locations that a function is allowed to modify. Other memory locations remain unchanged. A specification language typically provides
Write a Msglang program that declares a process that, when sent a number n as a message, prints n, and then sends itself n-1 as a message. This countdown terminates when n is 0.
Write a Msglang program that models a state machine. If the process receives an message containing number 0 followed by another message containing number 1, it prints “accept.” Otherwise, it
Using Msglang features, define a processbased sorting structure for positive and negative numbers. This structure will consist of four bins represented as global references(posevenbin, posoddbin,
In the current design of Msglang, the receive expression fails if the cardinality of the received message doesn’t match with the expected cardinality of the sent message. That might seem overly
If there are two receive expressions in the body of a process expression, and the first receive expression is expecting a message with two fields and the second receive expression is expecting a
Design and implement a variation of ProcExp and SendExp that supports prioritized message processing. Each message includes priority as its first field, a positive integer, where lower numbers mean
In the current design of Msglang, the receive expression fails if the cardinality of the received message doesn’t match with the expected cardinality of the sent message. In practice, stronger
In the current design of Msglang, a send expression transmits a message to the receiver and proceeds without waiting for a response from the recipient. This messagedelivery style is called
Design and implement a variation of Msglang in which each process has its own heap. Creating a process creates the heap of that process. Then, implement two variations of the send expression, as
A process is a garbage process if it is not performing independent computation, it is blocked to receive a message from another process, and there are no other processes that can send the process a
Write a Eventlang program that declares an event, CountDown, that accepts a single context variable, n. Register a handler with this event such that when the event is announced with the number n as
Write an Eventlang program that models a vending machine that dispenses four objects: milk, cookies, chocolate, and candy. The vending machine accepts an amount, dispenses the appropriate product,
Using Eventlang features, define an event-based sorting structure for positive and negative numbers. This structure will consist of four bins represented as global references (posevenbin, posoddbin,
The goal of this question is to learn about a variation of event-driven programming language features. A common variation of event support in languages and libraries allows programmers to specify a
The goal of this question is to learn about another variation of event-driven features by extending the semantics of the Eventlang language. We will learn about announce expressions that return
The goal of this question is to extend the Eventlang interpreter to add expressions for unregistering an observer expression. So far, we have only discussed registering an observer expression using
Showing 100 - 200
of 156
1
2