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?

  • 3
    $\begingroup$ Um... "alternatives"? $\endgroup$ – Raphael Jun 19 '16 at 15:24
  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.

  • $\begingroup$ Should they have different syntactic forms? $\endgroup$ – Little Alien Jun 19 '16 at 16:43
  • $\begingroup$ I'm not sure I completely understand your question (especially the meaning of the word "have" here). I'd say the alternatives define (normally different) syntactic forms. Does it make anything clearer? $\endgroup$ – Anton Trunov Jun 19 '16 at 16:51
  • $\begingroup$ If we turn to the TAPL example from the first link, then it says, that a term (t) is either true (syntactic category consisting of only 1 element), or false, or anif-expression (syntactic category of infinite number of elements), etc. $\endgroup$ – Anton Trunov Jun 19 '16 at 16:54
  • $\begingroup$ Does it mean that syntactic forms and alternatives are the same things, syntactic form is what the alternative defines? $\endgroup$ – Little Alien Jun 19 '16 at 17:06
  • $\begingroup$ I've updated the answer, trying to clarify that part. $\endgroup$ – Anton Trunov Jun 19 '16 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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