Thomas Honold <th***********@siemens.com> writes:
I want to generate C++ or Java code by script, e.g. classes with
getter/setter methods.
It very much depends on what type of code, and how many you want to
generate from which type of available input.
Someone told me that nowadays it is done with XML
and XSLT.
Is it? I don't care :-)
Depending of what needs to be done, I would use:
- for simple tasks a simple shell script
- a macroprocessor like m4 for generating code based on macros
"inlined" in some Java source.
- awk for generating code completely from some simple home-made
description language
- perl for generating code from some less simple, home-made
description language
- Special tools for specific tasks, e.g. a parser generator for
building some parser.
A shell is a Unix command line interpreter which usually allows some
form of scripting (shell scripts are extremely powerful compared to
DOS/Windows BAT/CMD files). M4 and awk are classic Unix text processing
tools, perl is a Unix scripting language. Ports are available for other
platforms, too.
/Thomas