HiveBrain v1.2.0
Get Started
← Back to all entries
snippetMinor

How do you call alternatives in the grammatical productions?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
theproductionsyoualternativescallgrammaticalhow

Problem

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?

Solution

-

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.

-

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.

Context

StackExchange Computer Science Q#59811, answer score: 4

Revisions (0)

No revisions yet.