in Compiler Design retagged by
457 views
2 votes
2 votes

Follow(S) comes as {(, ). $ }

So, do we count $ as terminal or not.

Could anyone please tell me, $ should be considered as terminal or not ?

** Although I think, I should not count it as a terminal because we do not put $ in the terminal set of CFG.

See here : https://en.wikipedia.org/wiki/Context-free_grammar#Example

$ is also marker to identify that parsing of string has been successfully completed. 

in Compiler Design retagged by
457 views

2 Answers

3 votes
3 votes

Follow of  S is  {(, ). $ }

Because S is a start Symbol and follow of start symbol is always $ .

So no of terminals here are 3.

0 votes
0 votes
follow of S will be{ ), $ }

number of terminal=2;

hence $included as terminal

2 Comments

follow of S is  {(, ). $ } &  it is correct.

please give me a reference why you r considering $ as terminal ?

0
0
ohhh i was mistaken...i left '(' in the follow .But again when i tried i found that this grammar is ambiguous ..so LL(1) not possible.

also we can take $ in the terminal list...
0
0