Topics related to the generation of code as the output of an application, instead of directly writing code by a programmer.
Questions tagged [code-generation]
3642 questions
28
votes
5 answers
How can I see the machine code generated by v8?
Does anybody know how I can see the actual machine code that v8 generates from Javascript? I've gotten as far as Script::Compile() in src/api.cc but I can't figure out where to go from there.

user36128
- 281
- 1
- 3
- 3
28
votes
9 answers
For what purposes have YOU used T4?
T4 has existed for several years in Visual Studio, but doesn't get a lot of attention. However, for those that know it, there seems to be some very creative and useful purposes.
I am researching some different ways that T4 is used, and I would…

Chris Melinn
- 2,046
- 1
- 17
- 18
28
votes
10 answers
Graphical Finite State Machine Editor
I am looking for a sophisticated graphical FSM editor that can export a model in a well-documented output format, like SCXML or similar.
Can anybody recommend me a tool?

Roland
- 436
- 1
- 5
- 11
28
votes
1 answer
Step by step, how do I add a custom build step for every file of a given type in Visual Studio 2010?
The Problem
I have a bunch of custom files in a visual studio 2010 project.
I need to run a tool on those custom files when they change.
The tool generates .h files included by existing .cpp files.
I would like the tool to run as part of the build…

Charles Randall
- 6,920
- 12
- 33
- 38
28
votes
1 answer
Generating code for another language in Haskell
I want to generate code for another language in Haskell, but I'm puzzled on how
to approach this problem. I'm looking for an abstract and elegant representation of the language in Haskell, which is also useful for code generation. The language in…

akosch
- 4,326
- 7
- 59
- 80
27
votes
2 answers
Python code generator
I want to be able to perform code generation of python given an AST description.
I've done static analysis of C and built AST visitors in python, so I feel relatively comfortable manipulating a syntax tree, but I've never attempted code generation…

mvanveen
- 9,754
- 8
- 33
- 42
27
votes
4 answers
R.raw.anything cannot be resolved
I'm developing an android apps with Eclipse.
In my app, I try to read a file : data.xml. I put it in res/raw/, and to access it i'm supposed to use getRessources().openRawResource(R.raw.data);
But Eclipse show me an error : "data" cannot be resolved…

Stéphane Piette
- 5,341
- 6
- 34
- 50
27
votes
5 answers
Python generating Python
I have a group of objects which I am creating a class for that I want to store each object as its own text file. I would really like to store it as a Python class definition which subclasses the main class I am creating. So, I did some poking around…

Jonathanb
- 1,224
- 1
- 11
- 16
27
votes
5 answers
Java reflection: How do I override or generate methods at runtime?
It is possible in plain Java to override a method of a class
programmatically at runtime (or even create a new method)?
I want to be able to do this even if I don't know the classes at compile time.
What I mean exactly by overriding at…

ivan_ivanovich_ivanoff
- 19,113
- 27
- 81
- 100
26
votes
1 answer
Can not generate source code with SBT 0.11 from "Full Configuration"
Based on sbt 0.11.0 documentation available ("Common Tasks" wiki page and others) and after seeing how this is done in Scalaz SBT build and in Scalate SBT build I can't figure out why my simple example does not work:
import sbt._
import…

Pablo Lalloni
- 2,615
- 19
- 20
26
votes
2 answers
Writing a JIT compiler in assembly
I've written a virtual machine in C which has decent performance for a non-JIT VM, but I want to learn something new, and improve performance. My current implementation simply uses a switch to translate from VM bytecode to instructions, which is…

jakogut
- 4,409
- 6
- 29
- 41
26
votes
4 answers
Is it possible to change IntelliJ's code generation template for equals() and hashCode()
Is it possible to change the code generation template for equals() and hashCode()?
I would like the generated code to use the Java 7 Objects class for theses methods.

Rylander
- 19,449
- 25
- 93
- 144
25
votes
2 answers
How to efficiently implement closures in LLVM IR?
I started adding closures (lambdas) to my language that uses LLVM as the backend. I have implemented them for simple cases where they can be always inlined i.e. code for the closure definition itself doesn't need to be generated, as it is inlined…

Erkki Lindpere
- 597
- 5
- 11
25
votes
8 answers
Shortcut for calling all the setter methods on an object in Eclipse?
I want to create an object of a class in and then set all the properties in it using setter methods. There are more than 150 setter methods and I do want to type each one of them or even type in the object instance name Object instance type in dot .…

simranNarula
- 641
- 3
- 9
- 14
25
votes
4 answers
T4 Generation: Where does VsNamespaceSuggestion() pull from?
Does anybody know, in a .tt file, where code.VsNamespaceSuggestion() gets its namespace from?
I'm having an issue where I had to change a solution's namespace, and I swear I've changed it everywhere (folder names, filenames, project names, project…

James in Indy
- 2,804
- 2
- 25
- 25