Questions tagged [compiler]
A compiler is a computer program that transforms source code written in one programming language into another computer language.
500 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
0
votes
1
answer
129
views
Generalised indexing scheme for variable memory layouts
structs are great, the only problem is that not only do they associate data (topo)logically, they also crystallise a memory layout for that set of concepts. I would like to avoid the latter.
So I'm ...
1
vote
2
answers
305
views
How modern runtimes handle both interpreted and JITted code at the same time?
I have a personal project, I want to write a JIT compiler/runtime in Rust (well, the language is not that relevant). I'm thinking about using a technique where the code is interpreted first and then ...
0
votes
5
answers
605
views
why languages need an import/include/using etc to refer to other code in other files?
In various languages I came across during my career require some import/using/include etc. to refer to the code in other file.
while the same languages also require a package manager or a list of ...
0
votes
1
answer
97
views
Concatenating strings given a BNF grammar
<Definition> ::= <Name> <LeftPar> <param> <RightPar>
<Name> ::= <Letter><LetterTail>
<LetterTail> ::= <Letter><LetterTail> | ‘’
A ...
0
votes
0
answers
116
views
Is it possible to build a semantically unambigous grammar / language / graph?
It's been a long time that I had an idea of a semantic constraint as compiler optimizations which allows for sophisticated high level optimization allowing you to transform the AST/CFG based on a SFG (...
1
vote
0
answers
437
views
Implementing a memory efficient Abstract Syntax Tree
I am writing a compiler in C++ 20. I am looking for ways to improve heap memory performance. For example, I can compile a 36.8 MB source file that is just many repeating lines of:
let x0: string = &...
1
vote
1
answer
245
views
Is there any logical reason to "store" just one object file (.o) into archival file (.a)?
As far as I understand (not much), the archival .a file is just, roughly speaking, the collection/batch of object .o files. It's like a library of compiled code that can be cached and which can be ...
1
vote
1
answer
160
views
How to approach converting to and from kafka messages?
I would like to have a series of small stand-alone services that would either consume a Kafka topic and output the data into a different system or the reverse: receive data from a system and produce ...
15
votes
6
answers
6k
views
Why is it necessary to mark classes as not inherited from? Can't an optimizer automatically detect that virtual calls are unnecessary?
In C# and C++, an apparent trend is in place to reduce / avoid inheritance:
C#: "Sealing types can improve performance."
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/...
user avatar
user417068
0
votes
1
answer
568
views
How do function inlining and Tail Call Optimization affect call stack?
I've just accidentally came across this answer about inlined functions and I'd like to know how this affects call stack. But I can't add comments because I don't have enough rep so I decided to ask ...
1
vote
0
answers
149
views
How can I represent a transformed AST between compilation stages?
I'm writing a compiler in Rust. I've reached the point where I have an AST and am ready to do symbol resolution, type-checking, etc. But, I'm unsure of how to represent an AST as containing "...
0
votes
1
answer
175
views
What lessons can be learned from the architecture/combination of ESLint and Prettier for linting and code formatting?
I was looking through the prettier docs and the prettier source code. It essentially has those defined helper functions to layout the text, given an AST. It operates on the level of the whole file, on ...
0
votes
1
answer
591
views
Implementing heap-allocated closures in LLVM
I'm writing my own F#-esque language and I'm using LLVM for code generation. I want my language to support continuation passing style and I think I've got TCO figured out but I cannot figure out how ...
0
votes
2
answers
348
views
Modular Design affects compilation time
Does modular design decrease compilation time in cpp? My professor said so, but I don't understand how, because the build and compilation time depend on the amount of code, right?
Also, wouldn't ...
-3
votes
3
answers
355
views
why do we need instructions set for processor or controller?
Why is it necessary to have an instruction set for processors and controllers? Can't we simply convert high-level language programs, like those written in C, directly into binaries without the need ...