4 ms·
Denotational semantics are a great way to capture the meaning of a programming language. If your language provides a denotational semantics it's a nice exercise
by siraben 6y ago
Denotational semantics are a great way to capture the meaning of a programming language. If your language provides a denotational semantics it's a nice exercise to implement them in a functional language. For instance, here's my implementation of R5RS Scheme in Haskell following the spec's semantics.[0]
A lot of toy Scheme implementations omit call/cc for instance because it can be hard to reason about and do correctly, whereas following the spec made it really easy.
[0] https://github.com/siraben/r5rs-denot https://github.com/siraben/r5rs-denot
- jpz 6y ago"Denotational semantics are a great way to capture the meaning of a programming language" - big claim - what is the meaning of a programming language? For example, if you able to capture what the meaning of a programming language is, then could you please demonstrate by communicating what "the meaning of the programming language" C is, for instance? This appears to be a nonsensical combination of words, as I do not recognise a programming language as having an intrinsic meaning?
- nv-vn 6y agoI think you're thinking of the wrong definition for "meaning." OP is talking about what code in a language means, i.e. when I see the code say `1 + 2` does that mean that the numbers signed or unsigned? Are they arbitrary precision or a certain size? What errors can result from the addition? Etc. It's essentially saying that you can look at a piece of code and formally define what it means to the computer