# Formal name for left/right-hand-side of an expression

Given an expression, such as `int x = y + 5`, we'd call `int x` the `left-hand side` (or `LHS`), and `y + 5` the `right-hand side` (or `RHS`). The whole expression is called, of course, an `expression` (or `equation`), but is there a generic term for a "side" of an expression?

`LHS` and `RHS` don't quite cut it when it comes to an expression such as `int x = y = 5` (gloss over the fact here that such assignments are generally bad practice!).

I'm toying with the term `component` to describe any "side", but was interested to see if there was a formal standard term already in use. Wikipedia only has "Sides of an equation", any better suggestions?

• in which language would "int x = y = 5" work? I would assume the use of parentheses would clarify evaluation order and hence, LHS and RHS. itu.dk/courses/BPRD/E2009/fundamental-1967.pdf is about as authorative as it comes... – lwm Aug 30 '13 at 8:57
• It's a general statement, none of this is in a particular language - I've seen such statements in a few languages, C# and Java come to mind I think but it's been a while since I touched either, so might not have been those - have definitely seen it used (and warned against) before though. Although it's not something I ever use myself. I think (don't quote me - like I say, it's not something I ever personally use) the flow is the same as `y = 5; int x = y;`. – Kai Aug 30 '13 at 9:03
• The point was the terms LHS and RHS doesn't work so well when there are 3 "sides" to an expression, and it seems there ought to be be a none-side-specific term for each "chunk" of an equation. As in, the LHS and RHS are collectively an ... [insert answer here]. 'chunk' or 'component' or 'part' are the best terms I have so far. – Kai Aug 30 '13 at 9:05
• @Kai (et al) the term term suggests itself. – High Performance Mark Aug 30 '13 at 9:07
• Are you thinking of "lvalue" and "rvalue" ? stackoverflow.com/questions/3601602/… – rwong Aug 30 '13 at 10:49

Assuming C, `x ? y : z` has three operands for the `?:` operator which are `x`, `y` and `z`. The syntactic element `int x = y = 5` is not parsed as an expression with a single operator; `x`, `y` and `z` are subexpressions but so is `y = 5`. `y` and `5` are operands of the operator `=`. There is no generic term to designate `x` and `y = 5` here: in general parsing terminology, they are operands of the declaration operator, but in C terminology, the word operand is reserved for things that C calls operators.
If you want to treat `int _ = _ = _` as a single unit (which isn't how C syntax works), you can refer to the pieces as the left, middle and right subterms.