Questions tagged [code-generation]
The code-generation tag has no summary.
66 questions
1
vote
3
answers
403
views
Code generation for multi-platform, multi-language library
I need to design a code generator system that produces serialisation/deserialisation libraries for multiple languages running on multiple platforms.
Hard Constraints
I need this to capture a pre-...
0
votes
1
answer
110
views
Identify downsides: versioning auto-generated Terraform source code [closed]
HINT: the purpose of this question is to identify downsides for the scenario described. If something is a downside, then it should be quantifiable and it should clearly have a negative impact.
...
-3
votes
2
answers
409
views
How to use Github Copilot for business software evolution (if possible at all)?
Github Copilot got update yesterday (2023 St. Valentine) https://github.blog/2023-02-14-github-copilot-now-has-a-better-ai-model-and-new-capabilities/ but still no information for its use in the ...
7
votes
2
answers
2k
views
How to generate java class files with framework boilerplate in a project?
The Java project I am working on currently has a complicated folder structure, and to add a new functionality, one needs to add many .java files in different places in order to let it work in our ...
0
votes
2
answers
270
views
How do I distribute a C++ compiler with my application?
I'm developing a commercial closed-source application that will have a user-interface, and the back-end will be generating C++ code that needs to be compiled to produce a final end result.
When I ...
0
votes
0
answers
898
views
Why does Protobuf generate outer classes for Java?
I googled this and found questions like "How to use Protobuf message as java class without a java outer class?" (https://stackoverflow.com/questions/60312156/how-to-use-protobuf-message-as-...
-6
votes
1
answer
230
views
Why is automatically generating automated tests frowned upon?
First, the most obvious grouse someone has against this I can think of is the intricacies of an actual method. It's not enough to merely ensure no errors are thrown. Functions usually contain ...
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
vote
0
answers
119
views
Why use code bootstrapping tools?
It seems pretty common knowledge that code is read far more than it is written. Does this mean that if a tool produces code that's checked in, then it's a net negative (saves the author some time in ...
3
votes
1
answer
1k
views
Integration of code generators in CI / CD pipeline
In my company, I'm currently working on a project with some (REST) web services involved. The development is based on the OpenAPI specification and the Swagger tooling. The target platform is an ...
4
votes
3
answers
875
views
When to use code generation over flexible programming
where I currently work, there is a team that uses code-generation to generate slight variations of a program. I find this a little bit awkward. I can imagine using code generators that produce complex ...
0
votes
1
answer
1k
views
In Qt or C++, is there a good means for creating a switch with dynamically generated cases, or should I just use a for loop (or something else)?
Presume this situation:
Max Number of 256 key slots.
Key slots are defined by a struct, and a variable for each (256) has to exist.
User defines which keys slots are active at initiation (in my ...
1
vote
3
answers
748
views
How to version generated code without checking them into VC?
I have written a code generator for my company, that basically has the following workflow:
entity xml definition
|
v
gets ...
6
votes
3
answers
872
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 ...
4
votes
3
answers
3k
views
How exactly is bytecode "parsed"?
How is Bytecode "parsed"?
It is my understand that Bytecode is a binary, intermediate representation of the syntax of a given programming language. Certain programming languages convert their source ...
6
votes
1
answer
462
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 "...
0
votes
2
answers
126
views
Modernize a compiler, late switch of generation-paradigm
Have been hired to modernize an old binary compiler that has been forgotten since a few years by people who have died already.
The compiler has
a parser,
an objectmodel and
a generator of ...
10
votes
5
answers
4k
views
Generating Java Classes with Compile-time Value Parameters
Consider a situation where a class implements the same basic behavior, methods, et cetera, but multiple different versions of that class could exist for different uses. In my particular case, I have a ...
2
votes
1
answer
308
views
Low cost exceptions implementation using metaprogramming [closed]
(preface - boring stuff, feel free to skip down to the implementation details)
I need to provide exception handling to a language I am working on. It "compiles" to a subset of C, and since I ...
1
vote
0
answers
152
views
Are facilities that generate HTML for you, considered harmful? [closed]
I will approach this from two directions (+ raw HTML itself being de-facto third)
Proprietary HTML-generating code
Code generating facilities provided by a popular library
Proprietary HTML-generating ...
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 };
...
1
vote
2
answers
222
views
Handling stylesheet from a real programming language
Lately I've been playing with CSS (and other web technologies). I'm a non-web programmer, and probably this is influencing way too much my approach.
I found CSS syntax very limited, thus gave a shot ...
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....
6
votes
4
answers
2k
views
What would the general design for an XSD to C# class converter look like?
I am looking to create a simple code generator to convert XSD definitions to C# classes. This is partly as a learning exercise, but I would also like to get some practical use out of it eventually.
...
2
votes
4
answers
2k
views
Unit Test code generation
We have a project that was written over a period of 2 years, but has a poorly designed architecture and not unit tests.
The software works well, but we're at the point where we want to refactor some ...