Questions tagged [semantics]
For questions related to the semantics of programming languages, i.e. the intent, meaning and action of syntactically valid code.
24 questions
34
votes
6
answers
6k
views
Why do most languages have a complete operator precedence?
I actually drafted most of this question before the relevant stack overflow question but it's still relevant.
C has a famously confusing operator precedence order. It is divided into 15 levels and ...
7
votes
2
answers
826
views
What should the semantics from branching from finally be?
This question is about the expected semantics when combining resource management with branching control flow. From my perspective, it applies equally to all finally-...
5
votes
1
answer
236
views
Prior art on precedence rules on template instantiation for inner entity clashes
I'm looking for prior art on languages handling clashes happening during template instantiation between inner entities. For example, if we have a type parameter E intended to be an exception type and ...
5
votes
1
answer
209
views
How is Go's DSE implemented?
Apparently, Go can implement a dead store analysis in the compiler without a CFG. I stumbled upon this example:
...
32
votes
4
answers
3k
views
Are there any advantages of evaluating expressions differently in compile time and runtime?
From https://rtfeldman.com/0.1-plus-0.2, on different floating point number semantics:
Go takes a different approach. When you write 0.1 + 0.2 in Go, that expression gets evaluated to 0.3 at compile ...
2
votes
1
answer
721
views
References in a language where everything is a reference?
I'm a big fan of Algol 68's treatment of variables. "Variables" are just constant references that point to memory allocated on the stack or on the heap. When you refer to a variable or a ...
2
votes
1
answer
326
views
Semantic modeling in Rust
Correct me if I'm wrong, but as I understand it, a compiler infrastructure such as Roslyn and maybe the JavaParser's symbol solver defines a semantic model with an unified semantic data type often ...
3
votes
1
answer
124
views
Does ActionScript 3's specification use "frame" to mean the same thing as "scope"?
The ActionScript 3 specification frequently uses the term "frame" within the verification phase such as in:
(1)
Code inside a with statement will have a <...
20
votes
3
answers
3k
views
How can I specify a programming language step-by-step more formally than by providing a reference interpreter?
I want to give an exact specification of the meaning of my programming language. I know how to write an interpreter for it, but:
I don't want to require people to read the interpreter code to learn ...
11
votes
4
answers
1k
views
Data structures for scopes and variable shadowing
Let's say I have some code in my target language like:
...
10
votes
1
answer
716
views
How can denotational semantics be defined for imperative statements?
Denotational semantics associate each term in a program with some mathematical object representing the meaning of that term. When I see denotational semantics explained (e.g. in this answer), this is ...
6
votes
5
answers
588
views
What languages have semantics with more than one "way" to execute each statement?
This is a difficult question to get across because I don't think there is an established term for what I'm asking about. In the title I've called it "ways" of executing statements, but I ...
3
votes
1
answer
321
views
Call-by-value: Left-to-right vs right-to-left
There are three standard evaluation strategies for the lambda calculus:
Call-by-value (CBV)
Call-by-name
Call-by-need
There are two variants of CBV that differ on how they behave with respect to ...
24
votes
8
answers
5k
views
Pros and cons of semantically-significant capitalization
In Go, capitalized identifiers are public (exported), while lowercase identifiers are private (within the package it's defined in). Most other programming languages don't have this sort of semantic ...
5
votes
1
answer
226
views
Algorithm for type resolution without forward declaration
I'm trying to find an algorithm/data structure behind type resolution without forward declaration. Something a little bit like this in Java:
...