Hello! So recently I have written a lexer/tokenizer and am working on a parser for a language with a friend. At this point everything is going great but I'm beginning to think about how I want to do code generation. Are there languages or systems that generate for example C code, compiles it then executes? If I were to do this how should I set this up? What are other ways code generation is done? Right now I'm thinking about generated C or maybe even D code and compiling. Any ideas or other methods? Thanks!
NardCake
30
Posting Pro in Training
Recommended Answers
Jump to PostI don't get what you mean by "code generation"? Please can you be a bit more specific about this. Are you talking more of say a drop down menue saying "Switch statement" and it'll generate a switch statement? Or.. A GUI where you drop buttons and it generats the code?
Jump to PostThere are two common options for the code generation. Most compilers have an "intermediate language" that is kind of like C but less human-readable (i.e., a basic procedural language, but more compact). Other compilers simply generate C code and then compile it (for example, the Comeau C++ compiler just generates …
Jump to PostWhat I'm mainly curious about is how the things you listed above that generate C code have that compiled?
They would generally rely on the system's C compiler (if there is one). For instance, matlab's real-time workshop (RTW) just generates a bunch of C source files and a …
All 9 Replies
phorce
131
Posting Whiz in Training
Featured Poster
NardCake
30
Posting Pro in Training
phorce
131
Posting Whiz in Training
Featured Poster
NardCake
30
Posting Pro in Training
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
phorce
commented:
Good advice.
+7
NardCake
30
Posting Pro in Training
mike_2000_17
2,669
21st Century Viking
Team Colleague
Featured Poster
NardCake
30
Posting Pro in Training
mark5rockzz_1
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.