World's most popular travel blog for travel bloggers.

[Answers] How do you call alternatives in the grammatical productions?

, , No Comments
Problem Detail: 

I have encountered a question, which asks what is a syntactic form. This motivated me to ask myself, what is the anatomy of the grammatic rule,

     S ::= A | B | C 

Anatomy established that S is called LHS whereas A | B | C is called expectedly RHS. But, how do you call the individual alternatives within the RHS? Is it related to your syntactic forms?

Asked By : Little Alien

Answered By : Anton Trunov

  1. how do you call the individual alternatives within the RHS?

As @Rafael mentioned, they are called alternatives.

Parsing Techinques: A Practical Guide, 2nd ed. (2008) by D. Grune and C.J.H. Jacobs, page 15:

There is a more compact notation, in which several right-hand sides for one and the same left-hand side are grouped together and then separated by vertical bars, |. This bar belongs to the formalism, just as the arrow $\to$, and can be read "or else". The right-hand sides separated by vertical bars are also called alternatives.

  1. Is it related to your syntactic forms?

From the same source (p. 13):

Non-terminals [S, A, B, C in the example] are called (grammar) variables or syntactic categories in linguistic contexts.

It seems the terms syntactic form and syntactic category are used somewhat interchangeably. So, if an alternative is a variable, then it represents a syntactic form, but if it has more complex structure (it can contain terminals, or several non-terminals), then we might say that from the point of view of the grammar's author the alternative does not represent a syntactic form. But someone else can always turn it into one by defining a new non-terminal with an appropriate RHS.

Since B.C. Pierce's syntactic forms include terminals (true, false, 0), I agree with the accepted answer that the term syntactic form is used somewhat informally and is not defined precisely.

Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/59811

3.2K people like this

 Download Related Notes/Documents

0 comments:

Post a Comment

Let us know your responses and feedback