Friday, October 31, 2014

Q&A Assignment #8 Chapter 6 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #8 Problem Set dan Review Questions dari Chapter 6 dari Sebesta.


Review Questions:

6. Q: What are the advantages of user-defined enumeration types?
A: Readability is enhanced very directly and named values are easily recognized, whereas coded values are not. In reliability this enumeration types provide two other advantages 
1. No arithmetic operations are legal on enumeration types 
2. No enumeration variable can be assigned a value outside its defined range.

7. Q: In what ways are the user-defined enumeration types of C# more reliable than those of C++?
A: C# enumeration types are like those of C++, except that they are never coerced to integer. So, operations on enumeration types are restricted to those that make sense. Also, the range of values is restricted to that of the particular enumeration type.

8. Q: What are the design issues for arrays?
A: 1. What types are legal for subscripts
2. Are subscripting expressions in element references range checked?
3. When are subscript ranges bound?
4. What does array allocation take place?
5. Are ragged or rectangular multidimensioned arrays allowed, or both?
6. Can arrays be initialized when they have their storage allocated?
7. What kinds of slices are allowed, if any?

9. Q: Define static, fixed stack-dynamic, stack-dynamic, fixed heap-dynamic, and heap-dynamic arrays. What are the advantages of each?
A: 1. Static: subscript ranges are statically bound and storage allocation is static (before run-time). Advantage: efficiency (no dynamic allocation).
2. Fixed stack-dynamic: subscript ranges are statically bound, but the allocation is done at declaration time. Advantage: space efficiency.
3. Stack-dynamic: subscript ranges are dynamically bound and the storage allocation is dynamic (done at run-time). Advantage: flexibility (the size of an array need not be known until the array is to be used).
4. Fixed heap-dynamic: similar to fixed stack-dynamic: storage binding is dynamic but fixed after allocation. Advantage: space efficiency, storage is allocated from heap, and binding is done when requested.
5. Heap-dynamic: binding of subscript ranges and storage allocation is dynamic and can change any number of times. Advantage: flexibility (arrays can grow or shrink during program execution).

10. Q: What happens when a nonexistent element of an array is referenced
in Perl?
A: A reference to a nonexistent element in Perl yields undef, but no error is reported.

Problem Set:

6. Q: Explain all of the differences between Ada’s subtypes and derived types.
A: A subtype is compatible with its base type, so you can mix operands of the base type with operands of the base type. For example:

subtype Week_Days is Integer range 1..7;
Since this is a subtype, you can (for example) add 1 to a weekday to get the next weekday.

A derived type is a completely separate type that has the same characteristics as its base type. You cannot mix operands of a derived type with operands of the base type. If, for example, you used:

type Week_Day is new Integer range 1..7;
Then you would not be able to add an integer to a weekday to get another weekday. To do manipulations on a derived type, you'd normally define those manipulations yourself (e.g., create a package). At the same time, a derived type does "inherit" all the operations of its base type (even some that may not make sense) so you do still get addition.

7. Q: What significant justification is there for the -> operator in C and C++?
A: The only justification for the -> operator in C and C++ is writability. It is slightly easier to write p -> q than (*p).q.
In C and C++, there are two ways a pointer to a record can be used to reference a field in that record. If a pointer variable p points to a record with a field named age, (*p).age can be used to refer to that field. The operator ->, when used between a pointer to a record and a field of that record, comfbines dereferencing and field reference. For example, the expression p -> age is equivalent to (*p).age. In Ada, p.age can be used, because such uses of pointers are implicitly dereferenced.

8. Q: What are all of the differences between the enumeration types of C++
and those of Java?
A: In C++, an enumeration is just a set of named, integral constants. In Java, an enumeration is more like a named instance of a class. You have the ability to customize the members available on the enumeration.
Also, C++ will implicitly convert enum values to their integral equivalent, whereas the conversion must be explicit in Java.

9. Q: The unions in C and C++ are separate from the records of those languages, rather than combined as they are in Ada. What are the advantages
and disadvantages to these two choices?
A: Advantage:
Unconstrained variant records in Ada allow the values of their variants to change types during execution.

Disadvantage:
However, the type of the variant can be changed only by
assigning the entire record, including the discriminant. This disallows inconsistent records because if the newly assigned record is a constant data aggregate, the value of the tag and the type of the variant can be statically checked for consistency.

10. Q: Multidimensional arrays can be stored in row major order, as in C++, or
in column major order, as in Fortran. Develop the access functions for
both of these arrangements for three-dimensional arrays.
A: Let the subscript ranges of the three dimensions be named min(1), min(2), min(3), max(1), max(2), and max(3). Let the sizes of the subscript ranges be size(1), size(2), and size(3). Assume the element size is 1.

Row Major Order:
location(a[i,j,k]) = (address of a[min(1),min(2),min(3)])
+((i-min(1))*size(3) + (j-min(2)))*size(2) + (k-min(3))

Column Major Order:
location(a[i,j,k]) = (address of a[min(1),min(2),min(3)])
+((k-min(3))*size(1) + (j-min(2)))*size(2) + (i-min(1))

Wednesday, October 29, 2014

Q&A Assignment #7 Chapter 5 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #7 Problem Set dan Review Questions dari Chapter 5 dari Sebesta.


Review Questions:

6. Q: What is the l-value of a variable? What is the r-value?
A: An l-value represents a storage region’s “locator” value, or a “left” value, implying that it can appear on the left of the equal sign (=). L-values are often identifiers. The term “r-value” is sometimes used to describe the value of an expression and to distinguish it from an l-value. All l-values are r-values but not all r-values are l-values.

7. Q: Define binding and binding time.
A: Binding is an association between an attribute and an entity, such as between a variable and its type of value, or between an operation and a symbol. Binding time is the time at which binding takes place. Binding and binding times are prominent concepts in semantics of programming language.

8. Q: After language design and implementation [what are the four times bindings can take place in a program?]
A: compile time: a variable in java bound to a particular data type, load time: a variable bound to a storage cell when a program is loaded into memory. link time: a call to a library subprogram is bound to the subprogram code. run time: certain variables declared in pascal and in c++ functions.

9. Q: Define static binding and dynamic binding.
A: Static binding: if it first occurs before run time and remains unchanged throughout program execution.

Dynamic binding: if it first occurs during execution or can change during execution of the program.

10. Q: What are the advantages and disadvantages of implicit declarations?
A: Implicit declarationscan be detrimental to reliability because they prevent the compilation process from detecting some typographical and programmer errors.


Problem Set:



6. Q: Consider the following JavaScript skeletal program:
// The main program
var x;
function sub1() {
var x;
function sub2() {
. . .
}
}
function sub3() {
. . .
}
Assume that the execution of this program is in the following unit order:
main calls sub1
sub1 calls sub2
sub2 calls sub3

a. Assuming static scoping, in the following, which declaration
of x is the correct one for a reference to x?
i. sub1
ii. sub2
iii. sub3
b. Repeat part a, but assume dynamic scoping.

A: a.) i.) sub1
ii.) sub1
iii.) Main

b.) i.) sub1
ii.) sub1
iii.) sub1

7. Q: Assume the following JavaScript program was interpreted using
static-scoping rules. What value of x is displayed in function sub1?
Under dynamic-scoping rules, what value of x is displayed in function
sub1?
var x;
function sub1() {
document.write("x = " + x + "<br />");
}
function sub2() {
var x;
x = 10;
sub1();
}
x = 5;
sub2();

A: Static Scope then x = 5, if Dynamic Scope then x = 10

8. A: Consider the following JavaScript program:
var x, y, z;
function sub1() {
var a, y, z;
function sub2() {
var a, b, z;
. . .
}
. . .
}
function sub3() {
var a, x, w;
. . .
}
List all the variables, along with the program units where they are
declared, that are visible in the bodies of sub1, sub2, and sub3, assuming
static scoping is used.

A: Sub1: a(sub1), y(sub1), z(sub1), x(main).
Sub2: a(sub2), b(sub2), z(sub2), y(sub1), x(main)
Sub3: a(sub3), x(sub3), w(sub3), y(main), z(main)
9. Q: Consider the following Python program:
x = 1;
y = 3;
z = 5;
def sub1():
a = 7;
y = 9;
z = 11;
. . .
def sub2():
global x;
a = 13;
x = 15;
w = 17;
. . .
def sub3():
nonlocal a;
a = 19;
b = 21;
z = 23;
. . .
. . .
List all the variables, along with the program units where they are
declared, that are visible in the bodies of sub1, sub2, and sub3, assuming
static scoping is used.

A: In sub1:
a=sub1
y=sub1
z=sub1
x=main

In sub2:
a=sub2
x=sub2
w=sub2
y=main
z=main

In sub3:
a=sub3
b=sub3
z=sub3
w=sub2
x=sub2
y=main

10. Q: Consider the following C program:
void fun(void) {
int a, b, c; /* definition 1 */
. . .
while (. . .) {
int b, c, d; /*definition 2 */
. . . 1
while (. . .) {
int c, d, e; /* definition 3 */
. . . 2
}
. . . 3
}
. . . 4
}
For each of the four marked points in this function, list each visible variable,
along with the number of the definition statement that defines it.

A: 1) Variables : a = 1 b = 2
c = 2 d = 2

2) Variables :
a = 1 b = 2
c = 3 d = 3
e = 3

3) Variables :
a = 1 b = 2
c = 2 d = 2

4) Variables :
a = 1
b = 1
c = 1

Monday, October 20, 2014

Q&A Assignment #6 Chapter 4 Review Questions & Problem Set

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #6 Problem Set dan Review Questions dari Chapter 4 dari Sebesta.


Review Questions:

6. Q: What is a state transition diagram?
A: State diagram, is a directed graph. The nodes of a state diagram are labeled with state names. The arcs are labeled with the input characters that cause the transitions among the states. An arc may also include actions the lexical analyzer must perform when the transition is taken.
State diagrams of the form used for lexical analyzers are representations
of a class of mathematical machines called finite automata. Finite automata
can be designed to recognize members of a class of languages called regular
languages. Regular grammars are generative devices for regular languages.
The tokens of a programming language are a regular language, and a lexical
analyzer is a finite automaton.

7. Q: Why are character classes used, rather than individual characters, for the letter and digit transitions of a state diagram for a lexical analyzer?
A: Suppose we need a lexical analyzer that recognizes only arithmetic expressions,including variable names and integer literals as operands. Assume that the variable names consist of strings of uppercase letters, lowercase letters, and digits but must begin with a letter. Names have no length limitation. The first thing to observe is that there are 52 different characters (any uppercase or lowercase letter) that can begin a name, which would require 52 transitions from the transition diagram’s initial state. However, a lexical analyzer is interested only in determining that it is a name and is not concerned with which specific name it happens to be. Therefore, we define a character class named LETTER for all 52 letters and use a single transition on the first letter of any name.

8. Q: What are the two distinct goals of syntax analysis?
A: First, the syntax analyzer must check the input program to determine whether it is syntactically correct.
When an error is found, the analyzer must produce a diagnostic message and
recover. In this case, recovery means it must get back to a normal state and
continue its analysis of the input program. This step is required so that the
compiler finds as many errors as possible during a single analysis of the input
program. If it is not done well, error recovery may create more errors, or at
least more error messages. The second goal of syntax analysis is to produce a
complete parse tree, or at least trace the structure of the complete parse tree, for syntactically correct input. The parse tree (or its trace) is used as the basis for translation.

9. Q: Describe the differences between top-down and bottom-up parsers.
A: Parsers are categorized according to the direction in which they build parse trees. Top-down parsers is in which the tree is built from the root downward to the leaves. While bottom-up parsers, in which the parse tree is built from the leaves upward to the root.

10. Q: Describe the parsing problem for a top-down parser.
A: The A-rules are A → bB, A → cBb, and A → a, a top-down parser must
choose among these three rules to get the next sentential form, which could
be xbB , xcBb , or xa . This is the parsing decision problem for top-down
parsers.


Problem Set

6. Q: Given the following grammar and the right sentential form, draw a parse
tree and show the phrases and simple phrases, as well as the handle.
S → AbB bAc A → Ab aBB B → Ac cBb c
a. aAcccbbc
b. AbcaBccb
c. baBcBbbc

A: (a) FIRST(aB) = {a}, FIRST(b) = {b}, FIRST(cBB) = {c}, Passes the test

(b) FIRST(aB) = {a}, FIRST(bA) = {b}, FIRST(aBb) = {a}, Fails the test

(c) FIRST(aaA) = {a}, FIRST(b) = {b}, FIRST(caB) = {c}, Passes the test

5. – aaAbb



Phrases: aaAbb, aAb, b

Simple phrases: b

Handle: b

-bBab



Phrases: bBab, ab

Simple phrases: ab

Handle: ab

c. aaAbBb: -

7. Q: Show a complete parse, including the parse stack contents, input string,
and action for the string id * (id + id), using the grammar and parse
table in Section 4.5.3.
A: 
Grammar:
1. E → E + T
2. E → T
3. T → T * F
4. T → F
5. F → (E)
6. F → id
Parse Table (pg. 196)

Complete parse:
Stack Content
Input String
Action
0
id * (id + id) $
Shift 5
0id5
* (id + id) $
Reduce 6, Goto(0, F)
0F3
* (id + id) $
Reduce 4, Goto(0, T)
0T2
* (id + id) $
Reduce 2, Goto(0, E)
0T2*7
 (id + id) $
Shift 7
0T2*7(4
id + id) $
Shift 4
0T2*7(4id5
+ id) $
Shift 5
0T2*7(4F3
+ id) $
Reduce 6, Goto(4, F)
0T2*7(4T2
+ id) $
Reduce 4, Goto(4, T)
0T2*7(4E8
+ id) $
Reduce 2, Goto(4, E)
0T2*7(4E8+6
id) $
Shift 6
0T2*7(4E8+6id5
) $
Shift 5
0T2*7(4E8+6F3
) $
Reduce 6, Goto(6, F)
0T2*7(4E8+6T9
) $
Reduce 4, Goto(6, T)
0T2*7(4E8
) $
Reduce 1, Goto(4, E)
0T2*7(4E8)11
$
Shift 11
0T2*7F10
$
Reduce 5, Goto(7, F)
0 T 2
$
Reduce 5, Goto(0, T)
0 E 1
$
Reduce 2, Goto(0, E)
- ACCEPT -


8. Q: Show a complete parse, including the parse stack contents, input string,
and action for the string (id + id) * id, using the grammar and parse
table in Section 4.5.3.
A: Grammar:
1.      E -> E + T
2.      E -> T
3.      T -> T * F
4.      T -> F
5.      F -> ( E )
6.      F -> id
Parse table: please note that S4 in row state 0 should be under ( , instead of under *.

No
Stack
Input
Action
1
0
( id + id ) * id $
Shift 4
2
0 ( 4
id + id ) * id $
Shift 5
3
0 ( 4 id 5
+ id ) * id $
Reduce 6, Goto(4, F)
4
0 ( 4 F 3
+ id ) * id $
Reduce 4, Goto(4, T)
5
0 ( 4 T 2
+ id ) * id $
Reduce 2, Goto(4, E)
6
0 ( 4 E 8
+ id ) * id $
Shift 6
7
0 ( 4 E 8 + 6
id ) * id $
Shift 5
8
0 ( 4 E 8 + 6 id 5
) * id $
Reduce 6, Goto(6, F)
9
0 ( 4 E 8 + 6 F 3
) * id $
Reduce 4, Goto(6, T)
10
0 ( 4 E 8 + 6 T 9
) * id $
Reduce 1, Goto(4, E)
11
0 ( 4 E 8
) * id $
Shift 11
12
0 ( 4 E 8 ) 11
* id $
Reduce 5, Goto(0, F)
13
0 F 3
* id $
Reduce 4, Goto(0, T)
14
0 T 2
* id $
Shift 7
15
0 T 2 * 7
id $
Shift 5
16
0 T 2 * 7 id 5
$
Reduce 6, Goto(7, F)
17
0 T 2 * 7 F 10
$
Reduce 3, Goto(0, T)
18
0 T 2
$
Reduce 2, Goto(0, E)
19
0 E 1
$
Accept


9. Q: Write an EBNF rule that describes the while statement of Java or C++.
Write the recursive-descent subprogram in Java or C++ for this rule.
A: <while_stmt> -> WHILE ‘(‘ (<arith_expr> | <logic_expr>) ‘)’ <block> <block> -> <stmt> | ‘{‘ <stmt> {<stmt>} ‘}’

10. Q: Write an EBNF rule that describes the for statement of Java or C++.
Write the recursive-descent subprogram in Java or C++ for this rule.
A: Assume the following non-terminals are given: <type>, <id>, <literal>, <assign>, <expr>, and <stmt_list>.

<for> -> for ‘(‘ [[<type>] <id> = <expr> {, [<type>] <id> = <expr>}] ; [<expr>] ; [<expr> {, <expr>}] ‘)’ ‘{‘ <stmt_list> ‘}’

Sunday, October 19, 2014

Q&A Assignment #5 Chapter 3 Review Question & Problem Set

Name : Vina Melinda
NIM  : 1801380106

Untuk kali ini saya akan menjawab Assignment #5 Problem Set dan Review Questions dari Chapter 3 dari Sebesta.

Review Questions:

6. Q: Define a left-recursive grammar rule.
A: A left-recursive grammar means that the parser can get into a loop in the parsing rules without making any progress consuming the input. A grammar is left-recursive if we can find some non-terminal A which will eventually derive a sentential form with itself as the left-symbol.

7. Q: What three extensions are common to most EBNFs?
A: Three extensions are common to most EBNFs:
a. The first extension denotes an optional part of a RHS, which is delimited by brackets. For example: <if_stmt> -> if ( <expr> ) stmt [ else <stmt> ]
b. The second extension is the use of braces in an RHS to indicate that the enclosed part can be repeated indefinitely or left out altogether. For example: <ident_list> -> ident {, <ident> }
c. The third extension deals with multiple choice options. For example: <term> -> <term> ( *|/|% ) <factor>


8. Q: Distinguish between static and dynamic semantics.
A: Static semantics is more on the legal forms of programs (syntax rather semantics) and is only indirectly related to the meaning of the programs during execution. Static semantics is so named because the analysis required checking these specifications can be done at compile time. Dynamic semantics is describing the meaning of the programs. Programmers need to know precisely what statements of a language do. Compile writers determine the semantics of a language for which they are writing compilers from English descriptions.

9. Q: What purpose do predicates serve in an attribute grammar?
A: Static semantics is more on the legal forms of programs (syntax rather semantics) and is only indirectly related to the meaning of the programs during execution. Static semantics is so named because the analysis required to check these specifications can be done at compile time. In many cases, the semantic rules of language state its type constraints.
Dynamic semantics is describing the meaning of the programs. Programmers need to know precisely what statements of a language do. Compile writers determine the semantics of a language for which they are writing compilers from English descriptions


10. Q: What is the difference between a synthesized and an inherited attribute?
A: The synthesized attributes are the result of the attribute evaluation rules, and may also use the values of the inherited attributes. The inherited attributes are passed down from parentnodes.In some approaches, synthesized attributes are used to pass semantic information up the parse tree, while inherited attributes help pass semantic information down it.

Problem Set:

6. Q: Using 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))


AGrammar in Example 3.2:
<assign> -> <id> = <expr>
<id> -> A | B | C
<expr> -> <id> + <expr>
| <id> * <expr>
| ( <expr>)

a. A = A * (B + (C * A))
Leftmost Derivation: 
<assign> -> <id> = <expr>
-> A = <expr>
-> A = <id> * <expr>
-> A = A * <expr>
-> A = A * (<expr>)
-> A = A * (<id> + <expr>)
-> A = A * (B + <expr>)
-> A = A * (B + (<expr>))
-> A = A * (B + (<id> * <expr>))
-> A = A * (B + ( C * <expr>))
-> A = A * (B + ( C * <id>))
-> A = A * (B + (C * A))
Parse Tree

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

Leftmost Derivation
<assign> -> <id> = <expr>
-> B = <expr>
-> B = <id> * <expr>
-> B = C * <expr>
-> B = C * (<expr>)
-> B = C * (<id> * <expr>)
-> B = C * (A * <expr>)
-> B = C * (A * <id> + <expr>)
-> B = C * (A * C + <expr>)
-> B = C * (A * C + <id>)
-> B = C * (A * C + B)

Parse Tree


c. A = A * (B + (C))
Leftmost Derivation
 <assign> -> <id> = <expr>
-> A = <expr>
-> A = <id> * <expr>
-> A = A * (expr>)
-> A = A * (<id> + (<expr>))
-> A = A * (B + <expr>)
-> A = A * (B + (<expr>))
-> A = A * (B + (<id>))
-> A = A * (B + (C))

Parse Tree


7. Q: Using the grammar in Example 3.4, show a parse tree and a leftmost
derivation for each of the following statements:
a. A = ( A + B ) * C
b. A = B + C + A
c. A = A * (B + C)
d. A = B * (C * (A + B))

A: Grammar in Example 3.4:
<assign> → <id> = <expr>
<id> → A | B | C
<expr> → <expr> + <term>
| <term>
<term> → <term> * <factor>
| <factor>
<factor> → ( <expr> )
| <id>


a. A = ( A + B ) * C
Leftmost Derivation
<assign> -> <id> = <expr>
-> A = <expr>
-> A = <term>
-> A = <term> * <factor>
-> A = <factor> * <factor>
-> A = <expr> * <factor>
-> A = ( <expr> ) * <factor>
-> A = ( <expr> + <term> ) * <factor>
-> A = ( <term> + <term> ) * <factor>
-> A = ( <factor> + <term> ) * <factor>
-> A = ( <id> + <term> ) * <factor>
-> A = ( A + <term> ) * <factor>
-> A = ( A + <factor> ) * <factor>
-> A = ( A + <id> ) * <factor>
-> A = ( A + B ) * <factor>
-> A = ( A + B ) * <factor>
-> A = ( A + B ) * <id>
-> A = ( A + B ) * C

Parse Tree

b. A = B + C + A
Leftmost Derivation
<assign> -> <id> = <expr>
-> A = <expr>
-> A = <expr> + <term>
-> A = <term> + <term>
-> A = <factor> + <term>
-> A = <id> + <term>
-> A = B + <term>
-> A = B + <factor>
-> A = B + <expr>
-> A = B + <expr> + <term>
-> A = B + <term> + <term>
-> A = B + <factor> + <term>
-> A = B + <id> + <term>
-> A = B + C + <term>
-> A = B + C + <factor>
-> A = B + C + <id>
-> A = B + C + A

Parse Tree


c. A = A * (B + C)
Leftmost Derivation
<assign> -> <id> = <expr>
-> A = <expr>
-> A = <term>
-> A = <term> * <factor>
-> A = <factor> * <factor>
-> A = <id> * <factor>
-> A = A * <factor>
-> A = A * <expr>
-> A = A * (<expr>)
-> A = A * (<expr> + <term>)
-> A = A * (<term> + <term>)
-> A = A * (<factor> + <term>)
-> A = A * (<id> + <term>)
-> A = A * (B + <term>)
-> A = A * (B + <factor>)
-> A = A * (B + <id>)
-> A = A * (B + C)

Parse Tree


d. A = B * (C * (A + B))
Leftmost Derivation
<assign> -> <id> = <expr>
-> A = <expr>
-> A = <term>
-> A = <term> * <factor>
-> A = <factor> * <factor>
-> A = <id> * <factor>
-> A = B * <factor>
-> A = B * (<term>)
-> A = B * (<expr>)
-> A = B * (<term>)
-> A = B * (<term> * <factor>)
-> A = B * (<factor> * <factor>)
-> A = B * (<id> * <factor>)
-> A = B * (C * <factor>)
-> A = B * (C * (<expr>))
-> A = B * (C * (<expr> + <term>))
-> A = B * (C * (<term> + <term>))
-> A = B * (C * (<factor> + <term>))
-> A = B * (C * (<id> + <term>))
-> A = B * (C * (A + <term))
-> A = B * (C * (A + <factor>))
-> A = B * (C * (A + <id>))
-> A = B * (C * (A + B))

Parse Tree


8. Q: Prove that the following grammar is ambiguous:
<S> → <A>
<A> → <A> + <A> | <id>
<id> → a | b | c

A: The grammar is ambiguous because there's to different parse tree can be made from grammar above

Ambiguous Parse Tree

 9. Q: Modify the grammar of Example 3.4 to add a unary minus operator that
has higher precedence than either + or *.
A: <assign> → <id> = <expr>
<id>        -> A | B | C
<expr>   -> <expr> + <term>   
                     | <term>
                     | - <factor>
<term>  -> <term> * <factor>
                     | <factor>
<factor>-> (<expr>)
                     | <id>

10. Describe, in English, the language defined by the following grammar:
<S> -> <A> <B> <C>
<A> -> a <A> | a
<B> -> b <B> | b
<C> -> c <C> | c


A: It means all sentences consisting of one or more A’s followed by one or more B’s and then also followed by one or more C’s.