The Gateway to Computer Science Excellence

+1 vote

I am confused in following kinds of Grammar they are;-

1) S - > AB

A -> Ba

B -> Bb

B - > c

2) S - > AB

A -> Ba

B -> Bb

B - > Epsilon

3) S - > AB

A -> Ba

B -> Bb

B - > dollar

what will be the I0 state of these three grammars.

In 1st what will be the look ahead of B -> Bb and B - > c are we need to consider a or a/b.

In 2n what will be the look ahead of B -> Bb and B - > c are we need to consider a or a/epsilon.

In 3rd what will be the look ahead of B -> Bb and B - > c can we consider $ as look ahead symbol.

1) S - > AB

A -> Ba

B -> Bb

B - > c

2) S - > AB

A -> Ba

B -> Bb

B - > Epsilon

3) S - > AB

A -> Ba

B -> Bb

B - > dollar

what will be the I0 state of these three grammars.

In 1st what will be the look ahead of B -> Bb and B - > c are we need to consider a or a/b.

In 2n what will be the look ahead of B -> Bb and B - > c are we need to consider a or a/epsilon.

In 3rd what will be the look ahead of B -> Bb and B - > c can we consider $ as look ahead symbol.

0 votes

The last Case is not required for understanding and you should not write $ in the production. It represents the start of the stack.

**For Concept:**

@Shubhanshu In short, look-ahead of a non-terminal is the same for its every production.

Watch this video: *Timestamp 5:38*

https://www.youtube.com/watch?v=1XD2wk52-Cs&list=PLEbnTDJUr_IcPtUXFy2b1sGRPsLFMghhS&index=16

–1 vote

Looks like your basics are not clear. I recommend to watch this series.

Compiler Design: https://www.youtube.com/playlist?list=PLEbnTDJUr_IcPtUXFy2b1sGRPsLFMghhS

Compiler Design: https://www.youtube.com/playlist?list=PLEbnTDJUr_IcPtUXFy2b1sGRPsLFMghhS

- All categories
- General Aptitude 1.9k
- Engineering Mathematics 7.5k
- Digital Logic 2.9k
- Programming and DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6.2k
- Compiler Design 2.1k
- Databases 4.1k
- CO and Architecture 3.4k
- Computer Networks 4.1k
- Non GATE 1.5k
- Others 1.5k
- Admissions 595
- Exam Queries 576
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 17

50,644 questions

56,531 answers

195,623 comments

101,351 users