Newest Questions
877 questions
0
votes
1
answer
171
views
Should every side-effect express mutual exclusion on its output?
I was baffled from that Haskell allows multiple concurrent tasks to print to stdout without a particular order. A code that demonstrates this (GHCi):
...
5
votes
2
answers
385
views
Flow-sensitive type refinement of polymorphic variants
My language has polymorphic variants (the same feature as OCaml's polymorphic variants), and I want to implement flow-sensitive type refinement when pattern matching polymorphic variants.
Here are ...
7
votes
2
answers
277
views
Why can't a parser for C++ be realized with a DPDA?
In the book of Wilhelm, Seidl and Hack, " Compiler Design, Syntactic and Semantic Analysis" they write on p. 10 (bold face emphasis is mine)
Most designers of programming languages have ...
1
vote
0
answers
138
views
How to implement a formatter for a templating/macro language that can be run over a wide range of different languages?
I'm considering writing a formatter for Jinja2. Jinja is a template language that can preprocess a wide variety of different languages, mostly HTML but it's also commonly used for XML, SVG, JSON, YAML,...
12
votes
4
answers
5k
views
Why not make all keywords soft in python?
In Python we have the concept of a soft keyword, which makes some keywords reserved only in some special cases (e.g. match, case ...
5
votes
1
answer
319
views
How to compile Discriminated Union types to Webassembly?
Assume that I have a simple language with the types I32 and F32, but also composite types like Tuples. I want to add Discriminated Union types, but I find it difficult to generate the wasm code in a ...
4
votes
2
answers
288
views
In HTML5, why does the `<source>` tag use the `src` attribute in `<video>` and `<audio>` elements, but it uses the `srcset` in a `<picture>` element?
I've been studying advanced HTML, and, I am wondering this: In HTML5, why does the <source> tag use the src attribute in <...
1
vote
1
answer
164
views
Lexing ambiguity with nested grouping repetition
All tokens in parsing source code must be unambiguous. Regular expressions are almost always used for lexing, but there is one problem in my mind.
Given the regex: ...
3
votes
1
answer
202
views
Is there any particular reason to only implement 2 and 3 input hypot?
I've checked the information on cppreference.com and found that there are only 2 and 3 input hypot function. I am wondering why not implement the variadic version ...
21
votes
6
answers
5k
views
Should a language have both null and undefined values?
Javascript for example has both null and undefined values. They are nearly equivalent: both are falsy values that denote absence ...
2
votes
2
answers
121
views
DCFG without using state table
I'd like to confirm whether a sketch of procedure over a DCFG (deterministic context-free grammar) can maintaining full functional equivalence over building a full states transition table and loop ...
7
votes
2
answers
442
views
Delimited continuations and foreign functions
Guile Scheme has had support for delimited continuations for over a decade. Much was written about it in a 2012 blog post: guile and delimited continuations.
They have a limitation: continuations that ...
21
votes
9
answers
8k
views
Why no "full-stack" SQL-like language?
I've been a user of SQL for a long time now, and it is regarded as extremely well-adapted for its various and widespread uses in data processing. I think you'll hardly find a business that owns a ...
0
votes
1
answer
327
views
How might I implement a `typeid` operator (returning the type of its argument as something, presumably as a string) in my compiler?
So, here is how strings work in my AEC-to-WebAssembly compiler. After the program is parsed, all strings except inline assembly ones are gathered in a C++ ...
2
votes
1
answer
317
views
Is `WebAssembly` (the object through which WebAssembly and JavaScript programs communicate) considered to be a host object or a native object?
In our front-end developer course at Algebra, we are being taught there are three different types of objects in JavaScript:
Native objects - those that are defined by JavaScript itself, such as ...