Wizard creating code in multiple programming languages

as part of our application i need to build a component that will output the code in php and asp which have the same functionality (and maybe the latest jsp). how can I make a component like this as generic as possible?

0


source to share


2 answers


You should be able to create a parse tree from all input languages.

For each output language, you need to create a tree transformation grammar set.



You may also need a runtime library to help translate routines that are not available in your output language.

+1


source


I would personally go with the Strategy Pattern . You can create a master code generation class and create it with a strategy.

PHPCodeStrategy ASPCodeStrategy



Then each of them can have a method called execute. Then you can add additional strategies to the line and expand your application.

Andrew

+1


source







All Articles