All Questions

Filter by
Sorted by
Tagged with
3 votes
1 answer
60 views

Representing multiple alternative ASTs in one structure

Sometime during the past year I read (possibly on SO/SE) about a topic that sounded interesting. Now I would like to pick it up but I can't find it again. My memory is somewhat vague, I'm afraid. I ...
Mankka's user avatar
  • 133
5 votes
0 answers
77 views

What are some of the challenges in implementing, and disadvantages of having, dependent types in a programming language?

I know about some of the potential advantages and the desirable features of Agda/Coq/F*/Idris2, etc. But what about the other side of things? For example, there seems to have been talk for years about ...
Municipal-Chinook-7's user avatar
-1 votes
2 answers
356 views

Which number should be considered as true/false?

What I want to ask is not the Boolean value at the type level, but the Boolean value in actual implementation. Because the ...
Aster's user avatar
  • 3,198
2 votes
1 answer
94 views

Why isn't the nullable marker in Dart a monad?

Consider the following code: ...
Michael Tsang's user avatar
-2 votes
0 answers
65 views

Where can I find the machine code manual of a computer? [closed]

I learnt that the complete set of things that a computer can do, is the set of machine code instructions that it was built to carry out. (Q) Where can I find/access the machine code and/or assembly ...
user1514263's user avatar
-4 votes
0 answers
55 views

Java code to trigger mouseMove for each pixel [closed]

Java code can be used to detect mouse movement even by 1 pixel at All mouse speeds, when using mouseEntered or mouseExited. How can make java do the same when I use mouse dragged or mouseMove to ...
Amitava Guha's user avatar
17 votes
7 answers
3k views

The static keyword and clarity in language design

Across languages that use the word static as a keyword or reserved word, I have observed it to mean: "This variable, despite being declared locally, shall be ...
Karl Knechtel's user avatar
1 vote
1 answer
203 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
  • 111
7 votes
3 answers
307 views

Why don't languages do automatic pimpl?

In the C++ community, there is a well know compilation cascade problem, that can be solved with the pimpl ideom https://herbsutter.com/gotw/_100/ Here's the problem: If you nest structs (with each ...
Tom Huntington's user avatar
6 votes
0 answers
186 views

What was the first language to use backslashes as escape characters in string literals?

I assume that C didn't originate the idea that, for example, the sequence \t inside a string literal should mean a tab character, that ...
Karl Knechtel's user avatar
3 votes
0 answers
174 views

How to implement type checking of generics?

I am implementing a toy language, for learning. As of now, it has a Rust-like syntax and I would like to implement monomorphization of Generic types. After parsing, I have an Abstract Syntax Tree. Now,...
Jonas's user avatar
  • 305
3 votes
0 answers
165 views

Languages in which array types must be declared before usage

Some languages require array types to be declared before an object of that type can be declared. In Ada, for example: ...
QF0's user avatar
  • 131
2 votes
1 answer
204 views

Is it practical to use binary trees as a sequential container?

Contiguous arrays do not mix with lazy evaluation. That's why Haskell doesn't have contiguous arrays as a primitive type, and why even GHC has a poor API for them. As such, I sought for a workaround. ...
Dannyu NDos's user avatar
0 votes
1 answer
264 views

From a parsing perspective, which is more efficient? Right-to-left or left-to-right argument parsing?

C (and other languages which allow variable argument lists) process function arguments from right-to-left. Pascal (and other languages with fixed-length argument lists) process function arguments from ...
warren's user avatar
  • 117
4 votes
1 answer
209 views

How to implement a control flow analyser?

I'm finishing right now the lambda expression's resolution for an ActionScript 3 compiler, but, in terms of control flow analysis I've some difficulty to get into it. I've searched for some existing ...
Hydroper's user avatar
  • 1,007
11 votes
1 answer
335 views

What is "graded modality" in type theory?

I'm referring to these papers: Graded Modal Dependent Type Theory (The Gerty Language) Quantitative program reasoning with graded modal types (The Granule Language) At first glance, it seems graded ...
tarzh's user avatar
  • 3,859
4 votes
2 answers
319 views

Can two infix operators have the same priority, but different associativity? If so, how would it be implemented in the parser?

I am interested, is it possible that, in some programming language, two infix operators have the same priority, but different associativity? If so, how is that implemented in the parser?
FlatAssembler's user avatar
11 votes
1 answer
260 views

What prevented fopen() from utilizing macros/flags but not fseek()?

In C, fopen() uses string literals such as "r" or "r+" or ...
CPlus's user avatar
  • 8,261
11 votes
4 answers
5k views

How do you correctly compile the chained comparison operators like ones that exist in Python (`a < b < c`), if `b` might have side-effects?

The most obvious way of supporting chained comparisons operators, such as a < b < c, is to rewrite it as ...
FlatAssembler's user avatar
4 votes
2 answers
213 views

What are the cons of inlining then optimizing and then reverse inlining?

In many programming languages, not all functions may be inlined. However, assuming that a language is designed in such a way that all functions may be inlined, what the disadvantages of inlining all ...
ggZQX6YPvD's user avatar
2 votes
1 answer
140 views

What programming languages exist which model the human beings using the application as language level constructs?

Most programming languages model the human beings using the system, as data like any other data. It is only through loose convention and framework level convention that things like authentication and ...
Bryan Rayner's user avatar
2 votes
1 answer
245 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,007
2 votes
1 answer
158 views

How is the VHDL operator `<=`, which can be both right-associative (signal assignment) and left-associative (less-than-or-equal), parsed?

One of the most confusing things to me about VHDL is that the <= operator can mean both "less than or equal to" and it can be a signal assignment ...
FlatAssembler's user avatar
0 votes
2 answers
113 views

Is it valid to call a configuration-format—with associated JSON-schema—a language?

Say I have a configuration file format that is very well defined; in say JSON format; with a JSON-schema defining what is allowed and how strict to be. Would it be too generous to call this a Domain ...
Samuel Marks's user avatar
22 votes
4 answers
4k views

How are "strong" and "weak" typing defined?

According to Wikipedia, the terms "strongly typed" and "weakly typed" do not have agreed-upon formal definitions: there is no precise technical definition of what the terms mean ...
kaya3's user avatar
  • 19.1k
6 votes
1 answer
134 views

What to do with subroutine calls when translating Abstract Syntax Tree to Control Flow Graph?

A newbie here! I'm implementing my current compiler in Haskell and at the moment I'm trying to do the translation of AST to Basic Blocks. Based on the book "Advanced Compiler Design and ...
NotAlfred's user avatar
  • 145
17 votes
10 answers
4k views

Are there any languages where conditions are not first-class expressions?

Novices writing in mainstream languages often don't realise that conditions like x < y are expressions which can occur anywhere an expression is syntactically ...
CPlus's user avatar
  • 8,261
17 votes
2 answers
3k views

What does it mean that a language has an "effect system"?

I struggle to get the thing about "algebraic effect systems". What is it really about? Is it mostly about that functions doing IO (e.g. http request) should have that IO-operation visible in ...
Jonas's user avatar
  • 305
6 votes
1 answer
112 views

Understanding the "operational" reading of typing judgements in PFPL by Robert Harper, Chapter 4 Statics

I'm reading Practical Foundations for Programming Languages by Robert Harper and am confused by the exercises in Chapter 4, "Statics", where he discusses a (monomorphic) type system. The ...
Jay Lee's user avatar
  • 223
8 votes
2 answers
357 views

How are algebraic data types implemented?

I'm trying to make a simple compiler, and am getting stuck with IR code generation for lists in my language. I asked around and learned about algebraic data types and how they work, but I can't seem ...
NotAlfred's user avatar
  • 145
2 votes
1 answer
254 views

What are the tradeoffs around supporting Unicode keywords and tokens?

Is the mass adoption of Unicode tokens as operators in general-purpose programming languages ​​a good idea? How acceptable is such a language to ordinary users and developers? Background I want to ...
Aster's user avatar
  • 3,198
7 votes
2 answers
495 views

Why implement function syntax as `f a b` or `f: a b` instead of `f(a,b)`?

Sorry if I am not using the correct terminology here, I'll correct it if it turns out to be that way. Programming languages such as Python or Mathematica typically have function syntax implemented as <...
CrSb0001's user avatar
  • 183
10 votes
2 answers
308 views

Is there a language where "everything is a dataframe"?

In APL, you don't need to write loops because scalar operations are automatically "broadcast" (mapped and zipped) across arrays. For example a grayscale image could be a 2D array, which is ...
dpercy's user avatar
  • 201
16 votes
0 answers
274 views

What impact do type sigils have on programmers?

Some languages, such as BASIC (STRING$), Perl ($scalar, @array, ...
Michael Homer's user avatar
  • 12.9k
4 votes
1 answer
221 views

How is Rosetta 2 capable of translating x87 instructions (which are stack-based) to ARM machine code (where the FPU is register-based)?

Rosetta 2 is a program that enables the new ARM-based Macs to run programs for old x86-based Macs by translating x86 machine code to ARM machine code. But how does it do that? What seems especially ...
FlatAssembler's user avatar
1 vote
1 answer
242 views

Type-checking Python vs Typescript

mypy is very slow, pyright is fast but not quick enough in a large codebase, and tsc gives an immediate intellisense and type errors. I do not know whether it is because Python has more complex type ...
mq7's user avatar
  • 113
6 votes
2 answers
894 views

What are the limitations of combining tracing GC with manual memory management?

TL;DR: Could a programming language that uses manual memory management use a tracing GC to rescue the usual suspects of memory leaks? I was reading about the Boehm GC and came across this page that ...
Sudoh's user avatar
  • 163
2 votes
1 answer
335 views

How would you implement an auto-correct feature for misspelled class attributes?

Suppose that we are working with an object oriented compiled language, such as somthing C-flavored or Java-flavored. There is a class named string ...
Samuel Muldoon's user avatar
-1 votes
1 answer
193 views

How does a multi compiler programming language receive editor support?

Wondering how does a language that indirectly compiles to languages of existing systems or software receive proper type hints, autocompletion, diagnostics, and syntax highlighting for customized file ...
Hydroper's user avatar
  • 1,007
0 votes
4 answers
450 views

How to design a programming language that can simplify/optimize algorithms?

Can I design or implement a programming language (doesn't have to be general purpose) such that "suboptimal" code in the language will become optimal after compilation? E.g., guaranteeing ...
minseong's user avatar
  • 125
14 votes
3 answers
476 views

What makes a language 'beginner-friendly'?

When asking someone the question, "Which coding languages should a beginner learn?", the answers I most frequently get are JavaScript or Python. In both cases, a big reason for being ...
Redz's user avatar
  • 1,058
3 votes
1 answer
869 views

How do languages with only reference counting deal with closures?

Reference counting works best if there are no cycles. But closures that allow access to every variable in the parent scope by default automatically create cycles. There are obvious solutions like only ...
user23013's user avatar
  • 2,390
3 votes
2 answers
254 views

Does a Rust implementation of the Monkey programming language require a garbage collector?

Awhile back I wrote a Rust implementation of the Monkey programming language by Thorsten Ball (https://monkeylang.org/). When I got done with it I was a bit surprised that I never used an Arc/Rc ...
lamont's user avatar
  • 139
3 votes
0 answers
129 views

What are some syntax options for wildcard matching? (+ extensions)

By "wildcard matching" I mean the following: * matches zero or more of any characters. E.g. B* matches any string ...
CoffeeTableEspresso's user avatar
14 votes
4 answers
1k views

Why do we need to divide lexing and parsing stages

Why do many typical parsers need to have two stages: tokenization and parsing? This isn't just a helping hand for manually-constructed parsers, as even generation tools do the same. For example, the ...
Aster's user avatar
  • 3,198
10 votes
3 answers
415 views

What should be the precedence of the bitwise operators relative to each others?

In C, the relative precedence of bitwise operators is as follows, from high to low precedence: ...
WhiteMist's user avatar
  • 281
24 votes
7 answers
12k views

Why do compilers typically convert code into abstract syntax/parse trees before the final product?

When I started researching parsing and compiling I started with simple mathematical expression parsers. Many of the existing implementations I found have an intermediate step of converting a string ...
CPlus's user avatar
  • 8,261
7 votes
1 answer
243 views

Theoretical Book on Compilers [closed]

I am looking for books that mostly discuss the theory of compilers (e.g. full-abstraction), and less how to actually build them. Basically, "compilers for mathematicians". Are there any such ...
IllogicalUser's user avatar
3 votes
1 answer
316 views

Why is type-punning at compile-time a no-go?

More on the topic of type-punning being problematic: C23 added constexpr and new rules as to how compile-time constants can be created and handled. We can now ...
CPlus's user avatar
  • 8,261
41 votes
7 answers
8k views

Why do (or don't) languages forbid unreachable code?

In Java, the following is a compile-time error, due to the unreachable statement: while(true) { break; System.out.println("unreachable"); } In ...
kaya3's user avatar
  • 19.1k

15 30 50 per page
1
2 3 4 5
16