Skip to main content

Questions tagged [semantics]

For questions related to the semantics of programming languages, i.e. the intent, meaning and action of syntactically valid code.

Filter by
Sorted by
Tagged with
31 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 ...
osa1's user avatar
  • 411
1 vote
1 answer
274 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 ...
texdr.aft's user avatar
  • 253
2 votes
1 answer
256 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 ...
Hydroper's user avatar
  • 1,017
3 votes
1 answer
113 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 <...
Hydroper's user avatar
  • 1,017
19 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 ...
David Young's user avatar
  • 2,237
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: ...
Rob N's user avatar
  • 1,083
10 votes
1 answer
558 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 ...
kaya3's user avatar
  • 19.7k
6 votes
5 answers
485 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 ...
kaya3's user avatar
  • 19.7k
3 votes
1 answer
237 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 ...
user76284's user avatar
  • 159
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 ...
bigyihsuan's user avatar
  • 1,821
4 votes
1 answer
164 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: ...
Clément Jean's user avatar
13 votes
1 answer
746 views

What are denotational semantics, and what are they useful for?

The semantics of a language can be specified either by denotational semantics or operational semantics. These are sometimes summarised as: Denotational semantics specify the "meaning" of ...
kaya3's user avatar
  • 19.7k
16 votes
1 answer
1k views

How can we define a denotational semantics for recursive functions?

Motivation I want to define a denotational semantics (see here or here) for recursive functions in my language, by representing them as mathematical functions. Background Consider a simple language ...
David Young's user avatar
  • 2,237
8 votes
2 answers
123 views

Semantics of Haskell's `seq`

The section "The seq Function" on https://serokell.io/blog/haskell-to-core mentions that The seq function, which ...
Bubbler's user avatar
  • 713
7 votes
4 answers
652 views

Can something like a Donkey Sentence exist in a programming language?

I am interested, whether, in some programming language, there can be something like a Donkey Sentence, a sentence that defies straightforward attempts to translate it into a formal language, but is ...
FlatAssembler's user avatar
2 votes
3 answers
256 views

How should a language with period-based tuple indexing be parsed?

A few languages, most notably Rust, have tuple-indexing syntax that looks like this: tuple.0 // Access the first element of tuple This syntax is quite similar to ...
Ginger's user avatar
  • 2,629
5 votes
1 answer
419 views

How could I implement a non-null pointer qualifier in a C-style language?

In C currently, pointers just are, and there are no qualifiers to tell programmers whether they can be null or not. Objective-C kind of solves this problem by adding ...
CPlus's user avatar
  • 8,321
1 vote
1 answer
114 views

What computation models are typically used when designing a language? [closed]

I am familiar with the standard computation models like the RAM model, stack model etc. And I also know that operational semantics for a language views the language features as transitions in a ...
jude's user avatar
  • 27
11 votes
2 answers
535 views

What are the different types of import semantics?

As per my current understanding, there are many different ways that imports, and other related operations, are handled in different programming languages. For example, ...
FireTheLost's user avatar
  • 1,613
8 votes
6 answers
410 views

How might one formally communicate/define/describe a programming language design?

How would one formally define a programming language? What are the ways in which one can think about how to communicate a programming language design? What languages and frameworks exist with which to ...
Lee's user avatar
  • 195