Date: 2008-09-21 12:50 am (UTC)
Is it the underlying statement that is ambiguous, or is it that we haven't sufficiently defined the syntax?

In computer programming (and, IIRC, in mathematics), precedence is defined. The statement x=4*3+7; isn't ambiguous because multiplication takes precedence over addition (in most languages).

Too, you can always use parentheses to override "natural" precedence. In the statement x=4*(3+7);, x takes the value 40, not 19, because sub-expressions in the innermost parentheses (only one set in this example) are interpreted (or compiled :) ) first. Liberal use of parentheses in programming to eliminate ambiguity is considered virtuous, as not everyone remembers the precedence of operators in a language, and some may switch between several languages with different rules.

The statement Q1Q2S would always be interpreted unambiguously and in the same way by a compiler (granted, different compilers might interpret it differently, but any given compiler would always handle the same way).
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

stoutfellow: Joker (Default)
stoutfellow

April 2020

S M T W T F S
    1 2 34
5 6 789 1011
12 13 14 1516 17 18
19202122232425
2627282930  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 30th, 2025 04:39 pm
Powered by Dreamwidth Studios