Skip to main content

Questions tagged [expressions]

For questions relating to expressions, or code that gets evaluated to a single value, in programming languages.

0 votes
2 answers
1k views

In most C-like languages, a call such as printf("%d", x) is followed by two parentheses; and I see that a statement such as ...
user avatar
2 votes
3 answers
1k views

I want the expression a && b = c in my language to mean that the value of c is assigned to ...
DannyNiu's user avatar
  • 467
10 votes
3 answers
2k views

I've found that many grammars have a production called PrimaryExpression or something along those lines. ECMAScript has ...
Lazar Ljubenović's user avatar
2 votes
1 answer
230 views

Some languages (for example C and C++) have assignment expressions, which means the assignment statement as a whole returns a value of the object specified by the left operand after the assignment. So ...
justANewbie's user avatar
  • 1,100
8 votes
3 answers
212 views

In a language with standard let and if expressions, what should be the their precedence such that they can be nested without parentheses? For example, I want to be able to parse both of these ...
Panda's user avatar
  • 249
9 votes
5 answers
731 views

An expression-oriented language sounds appealing, as I could have code logic inline in expressions and initializers. An if statement could just return the last ...
CPlus's user avatar
  • 10.5k
9 votes
3 answers
463 views

Some languages distinguish expressions from statements so that something like int x = 2; foo((x += 2)); is invalid. Other languages don't, so that a similar ...
Aman Grewal's user avatar
13 votes
8 answers
2k views

So I've seen that many languages return a NaN value when calculating an indeterminate arithmetic expression (e.g. 0/0). Other ...
The Empty String Photographer's user avatar
4 votes
6 answers
482 views

I have thought about how I could specify an expression separate from a statement. A fragment of code that resolves to a value. But void expressions are still ...
CPlus's user avatar
  • 10.5k
10 votes
5 answers
371 views

My language is expression based; many of its language constructs are not statements, but rather expressions that return a value. However, since everything is an expression, my grammar looks like ...
bigyihsuan's user avatar
  • 1,861
7 votes
5 answers
630 views

I've always wondered. Why do major languages let their addition and multiplication operators be so prone to integer overflow? My programming language would have separate operators to handle overflow. ...
Dannyu NDos's user avatar
  • 1,485