Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2834
| From | "matt.ti...@gmail.com" <matt.timmermans@gmail.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: What is the meaning of an expression? |
| Date | 2022-01-15 06:21 -0800 |
| Organization | Compilers Central |
| Message-ID | <22-01-058@comp.compilers> (permalink) |
| References | <AdgJPKhi/NiNfECvRNaA6+4Wq/M8OQ==> <22-01-052@comp.compilers> |
> 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.
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
What is the meaning of an expression? Roger L Costello <costello@mitre.org> - 2022-01-14 12:15 +0000
Re: What is the meaning of an expression? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2022-01-14 18:20 +0000
Re: What is the meaning of an expression? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-01-15 00:28 +0100
Re: What is the meaning of an expression? gah4 <gah4@u.washington.edu> - 2022-01-14 17:58 -0800
Re: What is the meaning of an expression? George Neuner <gneuner2@comcast.net> - 2022-01-15 02:05 -0500
Re: What is the meaning of an expression? "matt.ti...@gmail.com" <matt.timmermans@gmail.com> - 2022-01-15 06:21 -0800
Re: What is the meaning of an expression? Johann 'Myrkraverk' Oskarsson <johann@myrkraverk.invalid> - 2022-02-03 12:50 +0000
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-16 07:44 -0800
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-17 15:45 -0800
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-18 10:03 -0800
Re: What is the meaning of an expression? gah4 <gah4@u.washington.edu> - 2022-01-18 15:18 -0800
Re: What is the meaning of an expression? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-01-19 11:54 +0100
Re: What is the meaning of an expression? Jan Ziak <0xe2.0x9a.0x9b@gmail.com> - 2022-01-19 09:17 -0800
Re: What is the meaning of an expression? gah4 <gah4@u.washington.edu> - 2022-01-19 14:03 -0800
Re: What is the meaning of an expression? Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2022-01-20 13:02 +0100
Re: What is the meaning of an expression? dave_thompson_2@comcast.net - 2022-01-30 22:51 -0500
Re: What is the meaning of an expression? Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2022-01-19 20:13 +0200
Re: What is the meaning of an expression? Thomas Koenig <tkoenig@netcologne.de> - 2022-01-22 20:46 +0000
Re: What is the meaning of an expression? Thomas Koenig <tkoenig@netcologne.de> - 2022-01-19 20:51 +0000
csiph-web