Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Programming language design Problem

1. Design a naïve and simple programming language which consists of the following primitive five statement types as program constructs, beside the declaration statements: These program constructs are powerful enough to write almost every algorithm for finding a solution of any given problem. [Throughout the rest of this semester, we will continue to expand this primitive programming language by adding other features, such as some data types, function or recursive call.]

 

Declaration statements; (e.g., int x; float x; int array A[1..n-1]; float array A[1..n-1]; char x; )

read and write statement;

assignment statement;

if-then-else statement and if-then statement; and

while-do statement;

Composition statement; i.e., statement; statement(s);

 

For example, I can use these program constructs to input (such as read) and output (such as write) any given integers, find the sum of these given integers, and output their total.

 

program sum

begin

int x, sum;

sum := 0;

while (not end of file) do

{read x;

write x;

sum := sum + x;

}

write sum;

end

 

Using these program constructs I can write binary search algorithm, mergeSort algorithm, ...

You are free to create the descriptive details of these statements, which allow define a set of grammar rules (also called syntax rules) for these statements. You also can add other features. However, you are advise to make it as simple as possible.

 

In addition to other reserved words, you can use begin and end as reserved words and {

Statements } for defining a block-structured language. For your reference, some of the grammar rules are given as follows: The notation < ... > is used to denote nonterminal symbols. Otherwise, they are terminal symbols (e.g., the entire program sum ... end are terminal symbols, consisting tokens/identifiers/variables, constant, assignment operators, relation operator such as not, and <, and many reserved words).

 

=> begin end

=> |

| { }

=> |

| | { Statements }

=> while () do ;

=> if ( ) then ;

| if ( ) then else ;

=> : = ;

 

=> | +

=> | *

=> | | ( )

=> |

=> A|B| ...|X| Y | Z | a | b | ....| x | y | z | 0 | 1 | 2 | ... | 8 | 9 |

=> |

=> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

 

Note that { ... } for declaring block of statements, which could be nested, such as

begin ... { ... { .... } ... { ... { .... } ...} .... } end.

 

These grammar rules are not complete. You are free to develop a complete set of grammar rules for these statements. You are advised to expand the following grammar rules to cover most of the basic properties/features for the statements for developing a program for any given problem.

2. Construct a finite state machine M that accepts these variables, constants, assignment operators and others, as well as all the reserved words for this primitive programming language that you are defined in Problem 1.

3. Construct a pushdown automata N for accepting or rejecting any given program which is written based on these program constructs, developed in Problem 1.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M91720613
  • Price:- $50

Guranteed 36 Hours Delivery, In Price:- $50

Have any Question?


Related Questions in Programming Language

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As