Re: What is the meaning of an expression?

"matt.ti...@gmail.com" <matt.timmermans@gmail.com>
Sat, 15 Jan 2022 06:21:08 -0800 (PST)

          From comp.compilers

Related articles
What is the meaning of an expression? costello@mitre.org (Roger L Costello) (2022-01-14)
Re: What is the meaning of an expression? anton@mips.complang.tuwien.ac.at (2022-01-14)
What is the meaning of an expression? christopher.f.clark@compiler-resources.com (Christopher F Clark) (2022-01-14)
Re: What is the meaning of an expression? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-01-15)
Re: What is the meaning of an expression? gah4@u.washington.edu (gah4) (2022-01-14)
Re: What is the meaning of an expression? gneuner2@comcast.net (George Neuner) (2022-01-15)
Re: What is the meaning of an expression? matt.timmermans@gmail.com (matt.ti...@gmail.com) (2022-01-15)
Re: What is the meaning of an expression? 0xe2.0x9a.0x9b@gmail.com (Jan Ziak) (2022-01-16)
Re: What is the meaning of an expression? 0xe2.0x9a.0x9b@gmail.com (Jan Ziak) (2022-01-17)
Re: What is the meaning of an expression? 0xe2.0x9a.0x9b@gmail.com (Jan Ziak) (2022-01-18)
Re: What is the meaning of an expression? gah4@u.washington.edu (gah4) (2022-01-18)
Re: What is the meaning of an expression? DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2022-01-19)
Re: What is the meaning of an expression? 0xe2.0x9a.0x9b@gmail.com (Jan Ziak) (2022-01-19)
[7 later articles]
| List of all articles for this month |

From: "matt.ti...@gmail.com" <matt.timmermans@gmail.com>
Newsgroups: comp.compilers
Date: Sat, 15 Jan 2022 06:21:08 -0800 (PST)
Organization: Compilers Central
References: <AdgJPKhi/NiNfECvRNaA6+4Wq/M8OQ==> 22-01-052
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="52225"; mail-complaints-to="abuse@iecc.com"
Keywords: semantics
Posted-Date: 15 Jan 2022 12:28:43 EST
In-Reply-To: 22-01-052

> The meaning of an expression is the value of the expression.


That is not true. This might be said in a magazine article written for laymen
about programming languages, or in a philosophical context that doesn't refer
to practical work.


> The semantics of an expression is the value of the expression.


That's not right either. The semantics of the *language* determine the
meaning of expressions written in that language.


The meaning of an expression is what you communicate to the compiler or to
readers by writing that expression.


In C, for example,
        int a = 1+1;


means "declare a variable named a of type int, an initialize it with the value
produced by adding the integers 1 and 1".


The expression part of this, "1 + 1", means "the value produced by adding the
integers 1 and 1". This is *not* the same as "2". The compiler may
determine that it's equivalent to "2", and will *probably* not write out any
actual addition instructions, but what you *wrote* is an addition, and its
meaning is determined by the semantics of addition as defined in C.


Of course, expressions in most languages can also include function calls and
operators that produce side effects, like "printf("%d",++i);", which certainly
has a meaning even though it produces no meaningful value.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.