Professional Documents
Culture Documents
Home General Compiler LEX & YACC GATE Cloud Computing CUDA MPI OpenCL Lisp OpenMP Web Designing Linux
Database Networking Data Structures Java Android Multi-Threading Blogging Tips YouTube Tips Vocabulary PICT PPL Contact
Guest Blogging Higher Studies Portal Job Portal Subscribe Youtube Channel Amazon Links
Abbreviations in YouTube 1K
Computer In this post, we will see how to
Science (1) find FIRST and FOLLOW of a grammar. I
Amazon Affiliate have also given some examples for better
Program (1) understanding.
Amazon Links Total Pageviews
Summary (2)
What is FIRST of a Non-Terminal of a
Android (19) Grammar: 436,916
Android App A Non-terminal can generate a
Development sequence of terminals(non-empty string) or
(13) Subscribe YouTube Channel
empty string. The collection of initial terminal
Applet (4) Comrevo
of all these strings is called a FIRST of a Non-
YouTube 1K
Blogging Tips terminal of a Grammar.
(32)
C Plus Plus
Programming
(17)
C Programming
(10)
Cuda Programming
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Computer Watch following Video: CUDA program to add two matrices
Networks (4)
Java Swing Program To Add Two Numbers |
CUDA (16) How To Find First and Follow in Compiler Design … Java Swing program For Addition of Two
Watch later Share Numbers
Data Structures
(22) Interview Questions on CUDA Programming
How To Write
Blog (15) (say, LHS stands for Left Hand Side of grammar production, RHS stands for Right Hand
Java (80) Side of grammar production and X is any Non-Terminal in grammar)
LEX & YACC (8)
How to find set FIRST(X):
Linux (8)
For all productions whose LHS is X,
Lisp (1) 1. If RHS starts with terminal, then add that terminal to the set FIRST(X).
Mathematics (1) ϵ ϵ
2. If RHS is , then add to the set FIRST(X).
MPI (3)
3. If RHS starts with Non-Terminal(say Y), then add FIRST(Y) to the set FIRST(X). If
MS Excel
ϵ
FIRST(Y) includes , then, also add FIRST(RHS except Y) to the set FIRST(X).
Formulas &
Functions (5)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Nanded City
Pune (5)
How to find set FOLLOW(X):
Networking (10) 1. If X is "Start" symbol, then add $ to the set FOLLOW(X). (Reason: Each string
OPENCL (1) generated from grammar is assumed that it ends in $. For e.g. abc$ or a+b$. As that string
can be generated from the Start symbol, Start symbol is followed by $).
OPENMP (16)
2. If in any RHS, X is followed by terminal (say t), then add t to the set FOLLOW(X).
OpenMPI (3)
ϵ
3. If in any RHS, X is followed by Non-terminal (say Y), then add FIRST(Y) except to
Parallel
Computing (46)
ϵ
the set FOLLOW(X). If FIRST(Y) contains , then you have to also add FIRST of remaining
part of RHS after Y to the set FOLLOW(X). If remaining part of RHS after Y is empty, then
PPL (57) add FOLLOW(LHS) to the set FOLLOW(X).
SDL (2) 4. If X is the last symbol in any RHS (For e.g. Z->wX), then add FOLLOW(LHS) i.e.
Skill FOLLOW(Z) to the set FOLLOW(X). (Reason: RHS is derived from LHS. So whatever
Development follows RHS, also follows LHS. As X is last symbol in RHS, FOLLOW(X) includes
Lab (30)
FOLLOW(LHS)).
Socket
Programming (3)
Ubuntu (8)
S->xyz/aBC
Unboxing & B->c/cd
Review (1)
C->eg/df
Vedic
Mathematics (1)
FIRST(S)={x,a}
Vocabulary (1)
FIRST(B)={c}
Website FIRST(C)={e,d}
Designing (19)
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
S->ABCDE
A->a/ ϵ
B->b/ ϵ
C->c
D->d/ ϵ
E->e/ ϵ
FIRST(S)={a,b,c}
FIRST(A)={a, } ϵ
FIRST(B)={b, } ϵ
FIRST(C)={c}
FIRST(D)={d, } ϵ
FIRST(E)={e, } ϵ
FOLLOW(S)={$}
FOLLOW(A)={b,c}
FOLLOW(B)={c}
FOLLOW(C)={d,e,$}
FOLLOW(D)={e,$}
FOLLOW(E)={$}
3. Grammar:
S->AB
A->ϵ
B->ϵ
ϵ
FIRST(S)={ }
ϵ
FIRST(A)={ }
ϵ
FIRST(B)={ }
FOLLOW(S)={$}
FOLLOW(A)={$}
FOLLOW(B)={$}
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
4. Grammar:
S->Bb/Cd
B->aB/ ϵ
C->cC/ ϵ
FIRST(S)={a,b,c,d}
FIRST(B)={a, }ϵ
FIRST(C)={c, }ϵ
FOLLOW(S)={$}
FOLLOW(B)={b}
FOLLOW(C)={d}
5. Grammar:
S->(S)/ ϵ
FIRST(S)={(, }ϵ
FOLLOW(S)={$,)}
6. Grammar:
S->AB/C
A->D/a/ ϵ
B->b
C->ϵ
D->d
FIRST(S)={d,a,b, } ϵ
FIRST(A)={d,a, } ϵ
FIRST(B)={b}
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
FIRST(C)={ }ϵ
FIRST(D)={d}
FOLLOW(S)={$}
FOLLOW(A)={b}
FOLLOW(B)={$}
FOLLOW(C)={$}
FOLLOW(D)={b}
7. Grammar:
S->ASB/d
A->a
B->AB/b/ϵ
FIRST(S)={a,d}
FIRST(A)={a}
FIRST(B)={a,b, } ϵ
FOLLOW(S)={$,a,b}
FOLLOW(A)={a,d,b,$}
FOLLOW(B)={$,a,b}
8. Grammar:
E->TE'
ϵ
E'->+TE'/
T->FT'
ϵ
T'->*FT'/
F->id/(E)
FIRST(E)={id,(}
FIRST(E')={+, } ϵ
FIRST(T)={id,(}
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
ϵ
FIRST(T')={*, }
FIRST(F)={id,(}
FOLLOW(E)={$,)}
FOLLOW(E')={$,)}
FOLLOW(T)={+,),$}
FOLLOW(T')={+,),$}
FOLLOW(F)={*,+,),$}
9. Grammar:
X->YZ
Y->m/n/ϵ
Z->m
FIRST(X)={m,n}
FIRST(Y)={m,n, } ϵ
FIRST(Z)={m}
FOLLOW(X)={$}
FOLLOW(Y)={m}
FOLLOW(Z)={$}
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
How To Find First and Follow in Compiler Design …
Watch later Share
Watch on
Next: Intermediate code generation for sample language using LEX and YACC
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
To Find First compilation in Side Effect of
and Follow of a C language Global
Grammar Variables in C /
C++
Code
Optimization
Techniques in
Compiler
Design with
Examples
Labels: Compiler
16 comments:
Reply
Replies
Thank You.
Reply
Reply
Replies
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Thank You.
Reply
Reply
Replies
Reply
Excellent examples!
Many thanks to the author of the note and clear position, that's cool
Reply
Replies
Thank You.
Reply
Reply
Replies
Thank You.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Reply
Very helpful..All the examples are excellent for clearing the concept. Thanks to the writer. :)
Reply
Replies
Reply
Reply
Replies
Thank You.
Reply
Replies
Thank You.
Reply
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
Enter your comment...
Publish Preview
Google
Google Search
www.discoallnight.com
Buy Domain Name www.discoallnight.com on godaddy.com
www.incredibletelangana.com
Incredible Telangana Tourism
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD
www.solvemyquery.com Message *
How to find ubuntu 32 or 64 bit?
Send
Best viewed in Google Chrome browser. Theme images by chuwy. Powered by Blogger.
Create PDF in your applications with the Pdfcrowd HTML to PDF API PDFCROWD