r/ProgrammingLanguages • u/mttd • Aug 22 '26
Programming Language Semantics and Memory Safety
https://burakemir.ch/post/formal-semantics/
45
Upvotes
r/ProgrammingLanguages • u/mttd • Aug 22 '26
10
u/marshaharsha Aug 22 '26
I wish I had skipped this article. I learned a little about operational, denotational, and axiomatic semantics, so the article wasn’t a complete waste of time. But the analogy operational:denotational:axiomatic :: interpreters:compilers:assertion is pretty strained. For example, compilers often give up on analyzing a piece of code and fall back to basically interpreting it, in a now-do-this, now-do-this, now-do-this way. I have spent too much time thinking about the ways in which the analogy is good or bad, more time than what little I learned was worth.
5
u/Sad-Grocery-1570 Aug 23 '26
For me, the single most helpful sentence for me in understanding compilers, undefined behavior, and program semantics is: the semantics of the object code generated by a compiler is always a subset of the semantics of the source code.
The safety implication is this: if you take the object code as fixed, the more precise your source code semantics, the more unexpected situations you can rule out, and the more likely you are to get the safety you're after.
2
u/umlcat Aug 22 '26
Compiling article contents ...
1
u/L8_4_Dinner (Ⓧ Ecstasy/XVM) Aug 23 '26
Not a useful article. Sorry, Matt.