To understand the value of recursion in a programming


Part A-

1. What arguments can you make for the idea of a single programming language for all programming domains?

It would be ideal to have a single programming language for all

2. What arguments can you make against the idea of a single programming language for all programming domains?

3. What are the arguments for writing efficient programs even though hardware is relatively inexpensive?

4. Describe some design trade-offs between efficiency and safety in some language you know.

Part B-

1. Which of the three original goals of ALGOL design committee, in your opinion, was the most difficult to achieve at that time?

2. Make an educated guess as to the most common syntax error in Lisp programs.

3. Describe, in your own words, the concept of orthogonality in programming language design.

4. What are the arguments both for and against the idea of typeless language?

5. What is your opinion of the argument that languages that are too complex are too dangerous to use, and we should therefore keep all languages small and simple?

6. Why, in your opinion, do new scripting languages appear more frequently than new compiled languages?

Part C - Programming exercise

1. To understand the value of records in a programming language, write a small program in a C-based language that uses an array of structs that store student information, including name, age GPA as a float and a grade level as a string (e.g., "freshmen" etc). Also, write the same program in the same language without structs

2. To understand the value of recursion in a programming language, write a program that implements quicksort, first using recursion and then without recursion

Chapter 3

1. Us the grammar in example 3.2, show a parse tree and a leftmost derivation for each of the following statements

a. A = A * (B + (C * A))

b. B = C * (A * C + B)

c. A = A * (B + (C) )

2. Prove that the following grammar is ambiguous

a. ->

b. -> + |

c. -> a|b|c

3. Describe, in English, the language defined by the following grammar:

a. ->

-> a | a

-> b |b

-> c | c

4. Consider the following grammar:

a. -> a b

-> b | b

-> a | a

Which of the following sentences are in the language generated by this grammar?

a. baab

b. bbbab

c. bbaaaaaS

d. bbaab

5. Write a grammar for the language consisting of strings that have n copies of the letter a followed by the same number of copies of the letter b, where n > 0. For example, the strings ab, aaaabbbb, and aaaaaaaabbbbbbbb are in the language but a, abb,ba and aaabb are NOT.

6. Compute the weakest precondition for each of the following assignment statements and postconditions:

a. A = 2 * (b -1) - 1 {a > 0}

b. B = (c + 10) / 3 {b > 6}

c. A = a + 2 * b - 1 {a > 1}

d. X = 2 * y + x - 1 {x > 11}

Part D-

1. Perform the pairwise disjointness test for the following grammar rules.

a. A -> aB |b |cBB

b. B -> aB |bA| aBb

c. C -> aaA |b | caB

2. Perform the pairwise disjointness test for the following grammar rules.

a. S -> aSb | bAA

b. A -> b{aB} | a

c. B -> aB | a

3. Show a trace of the recursive decent parser given in Section 4.4.1 for the string a + b * c.

4. Show a trace of the recursive decent parser given in Section 4.4.1 for the string a * (b + c)

Part E- Programming excersises:

1. Design a state diagram to recognize the floating-point literals of your favorite programming language.

2. Write and test the code to implement the state diagram of problem 2.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: To understand the value of recursion in a programming
Reference No:- TGS01602199

Expected delivery within 24 Hours

©TutorsGlobe All rights reserved 2022-2023.