Question 1: WebAssembly is a small, well-defined language. It is specified using mainly sequent calculus. You can find the specification here: https://webassembly.github.io/spec/core/valid/instructions.html
Given this specification and notational conventions, we define several lower-level functions in
WebAssembly. Write sequent calculus definitions for the following functions; a- "The instruction t.const results in the same generic type."
b- "The instruction t.add takes two generic values and returns the same generic type" c- "The instruction t.eq takes two generic values and returns in an i32 value." Yes, WebAssembly implements Boolean as an Integer.
75 *response.body_mut() = Body::from("Sent request to external
76 webservice");
77 }
78
79 // ... more routers
80 }
81 eprintln!("Returning a response");
82 Box::new(future::ok(response)) 83 } a- Explain what do the numbers mean in line 9.
b- The function in line 20 uses Future; what is Future?
c- What does http://httpbin.org do (line 34)?
d- Give a definition for the body variable in line 45.
e- Explain the BoxFut type in line 51 f- Should BoxFut (Line 51) implement the Sync trait? g- Should BoxFut (Line 51) use a lifetime?
h- At some points, you will be using the following instruction:
$ curl localhost:3000/wait What does curl do?
Does this code use Async/IO, if not, how would you change the program to use it? Question 3:
Question 3: Libra (libra.org) is a major new product from Facebook. Libra is a cryptocurrency platform. Facebook expect to make billions from Libra and revolutionize the financial industry.
a- What language is Libra written in? b- Discuss the technical reasons why this choice of language suits the application and its objectives.
c- Libra uses many standard packages, including lazy_static, tokio, failure, etc. Briefly, describe each of these packages.
Question 4: Consider the following program:
a- What is nighty channel in Rust (check Playground) b- What are unstable features? c- Why can playground run this code (think O.S.) d- What is the output from this code?
e- Provide comments for the lines ending in #
#![feature(asm)] fn main() {
let message = String::from("James, you are completely mad\n"); syscall(message);
}
#[cfg(target_os = "linux")] fn syscall(message: String) { let msg_ptr = message.as_ptr(); let len = message.len(); unsafe { asm!("