Skip to main content

Questions tagged [compiler]

A compiler is a computer program that transforms source code written in one programming language into another computer language.

0 votes
1 answer
66 views

Concatenating strings given a BNF grammar

<Definition> ::= <Name> <LeftPar> <param> <RightPar> <Name> ::= <Letter><LetterTail> <LetterTail> ::= <Letter><LetterTail> | ‘’ A ...
User's user avatar
  • 11
0 votes
0 answers
73 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 (...
C5H8NNaO4's user avatar
  • 129
1 vote
0 answers
194 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 = &...
Wesley Jones's user avatar
1 vote
1 answer
208 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 ...
LeaBit's user avatar
  • 151
1 vote
1 answer
110 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 ...
mparada's user avatar
  • 11
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
0 votes
1 answer
270 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 ...
b3rry's user avatar
  • 3
1 vote
0 answers
99 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 "...
gmdev's user avatar
  • 119
0 votes
1 answer
151 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 ...
Lance's user avatar
  • 2,615
0 votes
1 answer
370 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 ...
Gabriel's user avatar
  • 11
0 votes
2 answers
196 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 ...
happy's user avatar
  • 11
-3 votes
3 answers
272 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 ...
Harshith Gowda's user avatar
-1 votes
1 answer
108 views

Debugging miscompile [closed]

Recently I encountered an issue at work where a unit test written in C++ would crash only when being compiled with MSVC 2017 (MSVC 2019 and up are fine). I tried to debug this issue and it seems like ...
yijiem's user avatar
  • 107
0 votes
1 answer
216 views

Is it true that variable type before name makes compiler work easier? [closed]

I have seen information that at least one of reasons why type placed before variable name is that it allows compiler easier evaluate size and type of variable. If so then how (what way) it eases this ...
Ya Y's user avatar
  • 29
-1 votes
2 answers
190 views

When writing a tokenizer, what is the standard practice for handling aliased language keywords?

When writing a tokenizer, what is the standard practice for handling aliased language keywords? For example, notethat signed short int is a language keyword in C++ and several aliases might be allowed....
Samuel Muldoon's user avatar

15 30 50 per page
1
2 3 4 5
34