472,145 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,145 software developers and data experts.

Code generation architecture question

I'm trying to figure out what the best architecture for doing code
generation would be. I have a set of ASTs that define a program, so
what should I do to for code generation. As I see it the 2 choices
are to have the ASTs have a generate code method that returns the
correct code for themselves, or to have a seperate class that
generates code for a given AST. The problem with the first is that it
isn't very flexible if I want to generate code for a new language/
platform, as well as the fact that it is very tightly coupled.
However the issue with the other approach is that I can't think of a
good way to write it without have a ton of if isinstance() calls. Any
thoughts on what the best appraoch would be?
Nov 14 '08 #1
0 879

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

51 posts views Thread by Mudge | last post: by
9 posts views Thread by bigoxygen | last post: by
reply views Thread by Rasmus Fogh | last post: by
9 posts views Thread by Hayato Iriumi | last post: by
171 posts views Thread by tshad | last post: by
13 posts views Thread by rrs.matrix | last post: by
31 posts views Thread by eliben | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.