> Chris Gray wrote: >> For JavaME I think it's the only way we'd be able to maintain a single >> source tree. We need to be able to "#ifdef out" references to classes >> we don't have, methods we don't implement, etc.. >> >> That much being said, I don't have a recommendation for a tool to use. >> Java syntax is sufficiently C-like that cpp is probably do-able, but >> we'd probably stumble over a whole series of gotcha's, and cpp isn't >> exactly [deity]'s gift to preprocessing anyway. Maybe one of the >> aspect-oriented tools (with which I am not at all familiar) could be a >> better bet?
You could always do "clean" source-to-source processing using SableCC...:-) Java is a nice language to parse, so you could do some clean parsing, instead of the dumb "unstructured text" replacement of preprocessors. Actually, if all you need if "ifdef'ing out" undesirable references, it could be done by "hiding" modification directives in structured comments, so that these comment remain "javac" invisible. This way you could make it such that: 1- Plain source compilation -> j2se . 2- Structured processed source compilation -> j2me . If you need it, there are 2 or 3 Java 1.5 grammars available for SableCC (different parsing approaches, not different syntax!). As I said, Java is a pleasure to parse when compared to C & C++. It's just an idea, of course... [I know that people can start religious wars about pre-processing; that's why I am suggesting a clean approach, so that j2se people don't have to pre-process]. Etienne -- Etienne M. Gagnon, Ph.D. http://www.info2.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/
signature.asc
Description: OpenPGP digital signature