开发者

Generating php from delphi - has anyone done it?

See How to escape quote PHP strings generated by Delphi?

I am just interested to hear if anyone has used Delphi (or possibly BCB) as a c开发者_如何学Code generator for PHP ...

(or thoughts about code generation from one language to another in general)

Hmm, any good books about code generation ?


I've generated javascript, SQL and Delphi many times. But mostly is basic substitution, (and the example in the post you mention looks the same), not really codegeneration in the "compiler" sense of the word.

But there are also many real compilers in Pascals and Delphi like dialects. The biggest one I think is Free Pascal (http://www.freepascal.org), which is a compiler for Object Pascal (aka delphi)

(added later:) Besides variable substitution, basic templating engines also fall in this category. Templates are sometimes easier maintainable than the same fragement code. Specially in html/cgi land this is used a lot.


You can generate anything from a tool which can export text files no?

You can write all by the hand, or in a "delphi style" by using Delphi for PHP http://www.embarcadero.com/products/delphi-for-php

best regards,


anyone has used Delphi (or possibly BCB) as a code generator for PHP

PHP - no, but I'm generating a lot of Delphi/Pascal code from Delphi. I've also generated all other things used for a web application: HTML, JavaScript, CSS - but never PHP because I didn't need that. So it's possible, but simply knowing it's possible is not going to help you much.

thoughts about code generation from one language to another in general

You need to look into "text template engines" for Delphi. I can't suggest any because I wrote my own (and I'm not planing on releasing my own under any license).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜