All Questions
Tagged with code-generation compiler
9 questions
23
votes
8
answers
6k
views
Detect manual changes to an autogenerated C header [closed]
I have a C header that is generated from a CSV file and a Python script. The C header mainly contains a list of #define constants.
I want to be able to detect manual changes to this header during ...
8
votes
3
answers
2k
views
code generation - would C be a good compiler backend?
In this and this stack overflow questions, the answers state that C as a compiler backend is a bad idea.
But why?
C has many compilers that can heavily optimize it. Every platform has a compiler ...
-1
votes
1
answer
852
views
How to make compiler portable?
I am writing a simple compiler. I have written lexer and parser and it now generates assembly code from given code. Now I need to write an assembler which generates machine code. But the problem is ...
6
votes
3
answers
846
views
Is SSA form worth it if code generating to a high level language?
I'm writing a compiler that compiles to C. This means that most of the time I piggyback on top of C for optimisations and generating code for multiple platforms.
Right now I can think of a few ...
6
votes
1
answer
425
views
Implementing a construct like Rusts `match` in C?
I'm writing a compiler that compiles to C, one thing I'm attempting to do is implement a construct like Rust's match:
// { some function
let mut foo = 32;
match foo {
3 => return "...
33
votes
6
answers
10k
views
Why do programs use call stacks, if nested function calls can be inlined?
Why not have the compiler take a program like this:
function a(b) { return b^2 };
function c(b) { return a(b) + 5 };
and convert it into a program like this:
function c(b) { return b^2 + 5 };
...
22
votes
4
answers
71k
views
How do we go from assembly to machine code(code generation)
Is there an easy way to visualize the step between assembling code to machine code?
For example if you open about a binary file in notepad you see a textually formatted representation of machine code....
10
votes
4
answers
2k
views
Writing a Compiler Compiler - Insight on Use and Features
This is part of a series of questions which focuses on the sister project to the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework. The ...
11
votes
2
answers
644
views
How easy should a language development framework be to use?
This is part of a series of questions which focuses on a project called the Abstraction Project, which aims to abstract the concepts used in language design in the form of a framework.
Another ...