Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

dupNum.bf ;>;[- ] readprint.bf ;: BrainFuck ge Description: BrainFuck is a very simple programming language notable for its extreme minimalism. It is not a practical

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

dupNum.bf

;>;[-<:>]

readprint.bf

;:

BrainFuck ge Description: BrainFuck is a very simple programming language notable for its extreme minimalism. It is not a practical language but one that was designed to challenge and amuse programmers. The language consists of only eight simple commands and an instruction pointer. A complete write-up is here https://en.wikipedia.org/wiki/Brainfuck. However, the version required for this project is slightly different in the reading and writing commands. Please read carefully To understand the language you must first understand the programming model. The model is made up of a sequence of characters that make up the CODE, and an unlimited sequence of integers that make up the DATA. A Code Pointer starts at 0, the location of the first command. A Data Pointer also starts at 0, the location of the first integer (also known as the current data element). All DATA integers are initialized to 0 with each run. Our version of this language is made up of the following eight, single-letter commands an Set the value of the current data element to an integer value supplied by the user. You should prompt the user with a '?" Print the current data element. Move the Data Pointer to the previous data element. Print an error and stop execution if the Data Pointer goes negative Move the data pointer to the next data element. There is no largest element. If the integer at the current data pointer is zero, move the Code Pointer to the right to the matching . Otherwise, do nothing. Print an error and stop execution if there is no matching brace. Move the Code Pointer left to the matching [. Print an error and stop execution if there is no matching brace ; : I 1 +Increment the current data element. Decrement the current data element. Data elements can go negative Spaces, tabs and newlines are ignored. A program is executed as follows 0. Set the Code Pointer and Data Pointer to 0. Initialize all the data elements to 0. 1. Get the command at the current Code Pointer 2. Execute the command 3. ncrement the Code Pointer 4. If there is another command at the Code Pointer, go to step 1 5. Otherwise, exit. BrainFuck ge Description: BrainFuck is a very simple programming language notable for its extreme minimalism. It is not a practical language but one that was designed to challenge and amuse programmers. The language consists of only eight simple commands and an instruction pointer. A complete write-up is here https://en.wikipedia.org/wiki/Brainfuck. However, the version required for this project is slightly different in the reading and writing commands. Please read carefully To understand the language you must first understand the programming model. The model is made up of a sequence of characters that make up the CODE, and an unlimited sequence of integers that make up the DATA. A Code Pointer starts at 0, the location of the first command. A Data Pointer also starts at 0, the location of the first integer (also known as the current data element). All DATA integers are initialized to 0 with each run. Our version of this language is made up of the following eight, single-letter commands an Set the value of the current data element to an integer value supplied by the user. You should prompt the user with a '?" Print the current data element. Move the Data Pointer to the previous data element. Print an error and stop execution if the Data Pointer goes negative Move the data pointer to the next data element. There is no largest element. If the integer at the current data pointer is zero, move the Code Pointer to the right to the matching . Otherwise, do nothing. Print an error and stop execution if there is no matching brace. Move the Code Pointer left to the matching [. Print an error and stop execution if there is no matching brace ; : I 1 +Increment the current data element. Decrement the current data element. Data elements can go negative Spaces, tabs and newlines are ignored. A program is executed as follows 0. Set the Code Pointer and Data Pointer to 0. Initialize all the data elements to 0. 1. Get the command at the current Code Pointer 2. Execute the command 3. ncrement the Code Pointer 4. If there is another command at the Code Pointer, go to step 1 5. Otherwise, exit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

4. Design a career management system.

Answered: 1 week ago

Question

4. Evaluation is ongoing and used to improve the system.

Answered: 1 week ago

Question

6. Effectively perform the managers role in career management.

Answered: 1 week ago