Answered step by step
Verified Expert Solution
Question
1 Approved Answer
How tiny a programming language can be ? Consider a minimalist workspace that only consists of 1 array and 1 pointer: unsigned int tape [
How tiny a programming language can be Consider a minimalist workspace that only
consists of array and pointer:
unsigned int tape;
unsigned int ptr &tape;
And a minimalist programming language that only consists of the following instructions:
Instruction Function C equivalent
Move pointer one position to the right ptr;
Move pointer one position to the left ptr;
Increment the contents of the pointer ptr;
Decrement the contents of the pointer ptr;
dot Output the contents of the pointer cout ptr endl;
comma Take user input and store it at the place that
pointer is pointing to
cin ptr;
If contents of the pointer are not proceed, else
skip to its matching
whileptr
If contents of the pointer are not go back to its
matching else proceed
end while
Simulate the following programs and observe the output. Also explain what each of these
programs is doing?
Sample Instructions: Add to input
Multiply the input by
aSolution available in the folder for this part
b
cHow tiny a programming language can be Consider a minimalist workspace that only
consists of array and pointer:
unsigned int tape ;
unsigned int & tape ;
And a minimalist programming language that only consists of the following instructions:
Simulate the following programs and observe the output. Also explain what each of these
programs is doing?
Sample Instructions:
a
Add input
Multiply the input
b
Solution available in the folder for this part
c
I will also include the "solution" mentioned in our instructions:
#include
using namespace std;
void commaunsigned int ptr
cout ;
cin ptr;
int main
unsigned int tape;
unsigned int ptr &tape;
commaptr;
ptr;
commaptr;
ptr;
while ptr
ptr;
ptr;
ptr;
ptr;
ptr;
cout ptr endl;
return ;
Step 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