Suppose I have a grammar such that there exist $n$ production rules which contain only terminal symbols, and none of these rules produce the same terminal (disjoint).

$A ::= x|y|z$

$B ::= a|b|c$


$N ::= l|m|k$

Further suppose that I cannot simply merge these production rules together as they are used in different parts of the grammar.

How can I hence determine or rather choose, the start non-terminal $S$, for purposes of $LL(1)$ parsing?



1 Answer 1


By definition a grammar is a tuple $(N,T,P,S)$ where $N$ is the set of non-terminals, $T$ is the set of terminals, $P$ is the set of productions, and $S \in N$ is the start symbol.

Therefore if you have a grammar you already have $S$ (and if you don't know $S$ then you don't have a grammar).

  • $\begingroup$ I see, then I have to check with who gave me the productions. $\endgroup$ Apr 12, 2020 at 10:50
  • $\begingroup$ A common convention is that the non-terminal at the left hand side of the first production is start symbol. But the given grammar makes no sense, it just generates a set of words from one non-terminal, all the others are useless (as they can't be used at all). $\endgroup$
    – vonbrand
    Apr 12, 2020 at 15:33
  • $\begingroup$ @vonbrand Yes, however I did not list the entire grammar here. $\endgroup$ Apr 15, 2020 at 20:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.