FIRST(A) = { b, epsilon }
FIRST(S) = { b, epsilon }
FOLLOW(S) = { a, $ }
FOLLOW(A) = { a, b, $ }
What is the Arithmetic Expressions for this First & Follow set?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
FIRST(X)= the terminals which can appear first when trying parse the non-terminalX. If it can match an empty string, epsilon is also included.FOLLOW(X)= the terminals which can appear immediately after the non-terminalX. This is a union of the FIRST-sets of all symbols appearing afterXin any parsing rule.Read more: LL parser
The clues given are:
FIRST(A),FIRST(S)⇒ All of the derivations ofAandSrespectively, must either begin with the terminalb, or be zero-length.FOLLOW(S)⇒ There must be some construction whereSis followed by the terminala, or a non-terminal which can begin witha. (NeitherAnorSqualify).FOLLOW(A)⇒ There must be some construction whereAis followed by each of the terminalsaandb, or some non-terminal which can begin with those.FOLLOW(A)⇒ AssumingSis the start-symbol,Amust appear at the end of some branch ofS, possibly followed by other nullable non-terminals.(NB. Adding
AtoSdid not break the constraint onFIRST(S))We can make the grammar a little smaller:
We can no longer generate strings like “
bbbabb“, but it does not violate the constraints.