Linked Questions
19 questions linked to/from When does it make sense to compile my own language to C code first?
138 votes
27 answers
33k views
Is source code generation an anti-pattern?
If something can be generated, then that thing is data, not code. Given that, isn't this whole idea of source code generation a misunderstanding? That is, if there is a code generator for something, ...
201 votes
10 answers
84k views
Is every language written in C?
Sometimes while programming in different languages (C/C++, C#), this thought comes to my mind: Is each and every language written in the C programming language? Is the C language the mother/father of ...
15 votes
8 answers
11k views
Why C++ to write a compiler?
I was wondering why C++ is a good choice to write a compiler. Of course C is good for this purpose too, because many compilers are written either in C or C++ but I am more interested in C++ this time. ...
6 votes
7 answers
10k views
How can variables be created at runtime? [closed]
Is it possible to define variables dynamically? Last night I was writing some code (C and VB2010) and I ran into a problem related to defining variables in my program. The variables needed depend on ...
12 votes
6 answers
3k views
Is there a way to use gcc as a library?
Anyone knows a solution that works something like this: #include <stdio.h> #include <gcc.h> /* This .h is what I'm looking for. */ int main (void) { /* variables declaration (...) */ ...
3 votes
6 answers
2k views
Should I use a source-to-source or a traditional compiler in order to develop my own Programming Language?
I'm really interested in writing my own general-purpose high-level programming language, but I'm somewhat confused. I know that Python and Ruby were written in C, which makes me wonder that if I want ...
9 votes
2 answers
2k views
Robustness and pointer safety in C++
I'm currently building a server responsible of storing and managing few million records of fairly complex and interconnected data. For reasons beyond my control the work has to be done with C++. I ...
5 votes
2 answers
3k views
Say I wanted to create a cross platform program that does not require a runtime/VM, am I stuck with C/C++? [closed]
Let's say that I'm a theoretical programmer hunting for a cross platform programming language, what are my options. This language must satisfy this list of requirements: It must not require the user ...
3 votes
4 answers
2k views
Why do some compilers generate direct machine code?
I was taking this course - CMU 18-447, Computer Architecture at Carnegie Mellon to brush my knowledge and concepts. They say that most of the machine level details and implementations are taken care ...
2 votes
4 answers
4k views
Why does C provide both the comma operator and the semicolon to separate statements?
Both the comma operator and the semicolon can be used to separate statements. Let's consider this simple code: #include <stdio.h> void do_something(int*i) {(*i)++;} int main() { int i; ...
4 votes
3 answers
856 views
Does a Completely Full-Featured Intermediate Language Exist?
Often when translating between languages (whether with program translation or compiling) it's a one-way, destructive translation. The functionality of the "port" isn't lost, but some of the intent ...
4 votes
2 answers
3k views
How do I make this functional DSL written in an imperative language more efficient?
Suppose I create a simple functional Domain-specific language (DSL) using an imperative language, in this case C++. Here is a simple implementation of a DSL that can has the notion of a simple value ...
2 votes
1 answer
1k views
Do bytecode compilers compile syntax directly or intermediate assembly language?
I am going to write a very simple VM and bytecode compiler. Is it typical for a bytecode compiler to read the syntax and attempt to create the bytecode directly or is there an intermediate stage to ...
-1 votes
1 answer
863 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 ...
5 votes
2 answers
2k views
Type-based memory safety without manual memory manage or runtime garbage collection? [closed]
Let's say we wanted a typeful, pure functional programming language, like Haskell or Idris, that is aimed at systems programming without garbage collection and has no runtime (or at least not more ...