I'm writing a document where I have to describe some of the properties of a type system as they relate to a particular formal grammar.

I was trying to refer to the right-hand-sides of the last two productions in the grammar when it struck me that it's very strange that I've pretty much always heard the left- and right-hand sides describes as such. In particular it seems like an artifact of our notation having its roots in languages which are read from left-to-right.

It would make sense for there to be terms like in logic, where the left-hand-side of an implication is the antecedent and the right-hand-side is the consequent. These words don't refer to the notation properties, but actually describe the meaning of the implication from each side (although I suppose you could make the argument that they are artifacts of our conception of causality, but at least this provides some insight into the interpretation of the terms rather than the notation).

What I've tried so far:

I thought about it for a little while and the most natural words I could come up with were source and destination (obviously for the left- and right-hand-sides of the production, respectively.)

Sources I've checked:

  1. Looked through a couple of my textbooks on formal languages and compilers;
  2. Checked some likely Wikipedia pages;
  3. Skimmed/ctrl+f'd some online teaching resources, and of course;
  4. Checked math.stackexchange and also cstheory.stackexchange

Are there alternative names which are in colloquial use among computer scientists for referring to these components?

  • 2
    $\begingroup$ I've only seen LHS/RHS, but I don't really like those either. This could be your chance to coin the terms! antecedent/consequent, source/destination, factor/product, progenitor/progeny, origine/terminus, discordant/denouement, transmogrifactor/transmogrifaction, alpha/omega, bud/flower, frog/prince. $\endgroup$ – usul Dec 14 '12 at 4:45
  • $\begingroup$ I like "replacement" for the RHS. Not sure about the LHS. "replacee"? "replacend"? $\endgroup$ – Max Dec 14 '12 at 9:29
  • $\begingroup$ Are your formal grammars context-free? Most of the ones I've worked with are (in describing programming languages) and so I usually say "nonterminal Foo" for the LHS and "rule for nonterminal Foo" for the whole thing; usually clear from context that it's referring to the RHS. $\endgroup$ – Chris Pressey Dec 14 '12 at 12:13
  • $\begingroup$ Would "term" and "expansion" suit you? $\endgroup$ – Niel de Beaudrap Dec 14 '12 at 15:08
  • $\begingroup$ Although I am not completely sure, I believe the RHS can be termed as the 'pattern' and the LHS can be termed as the 'reduction'. This comes from the fact that when a parser reads a language it parses the patterns and reduces them to new rules (or shifts to parse and find new patterns). $\endgroup$ – Yet Another Geek Dec 15 '12 at 13:10

Your Answer

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

Browse other questions tagged or ask your own question.