即时编译和执行C ++程序 [英] On-the-fly compilation and execution of C++ program

查看:83
本文介绍了即时编译和执行C ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们正在设计一些东西,它们会生成c ++程序

我们想要的是我们想要执行生成的代码....




1.基于Xml的语言

2.从1生成的C ++代码。[它在1& 2]

3.编译

4.执行。


我们在编译时遇到了什么,我们希望我们的用户应该

不要关心编译或c ++代码生成等...他们只是在
写一些xml代码它应该执行!


[我们正在开发类似事件处理器,反应器系统等]

-Raxit

Hi,
we are designing some stuff , that will generate c++ program(s)
What we want is we wanted to execute that generated code....

i.e.
1. Xml based language
2. C++ code generated from 1.[Its mapping between 1 & 2]
3. compilation
4. execution.

What we have got stucked at compilation, we want that our user should
not take care about compilation or c++ code generation etc...They just
write some xml "code" and it should execute !

[we are developing something like Event processor, reactor system etc]
-Raxit

推荐答案

Ra***@MyKavita.com 写道:
Ra***@MyKavita.com wrote:




我们正在设计一些东西,这将生成c ++程序

我们是什么想要的是我们想要执行生成的代码....


ie

1.基于Xml的语言

2. C ++从1生成的代码。[它在1和1之间的映射2]

3.编译

4.执行。


我们在编译时遇到了什么,我们希望我们的用户应该

不要关心编译或c ++代码生成等...他们只是在
写一些xml代码它应该执行!
Hi,
we are designing some stuff , that will generate c++ program(s)
What we want is we wanted to execute that generated code....

i.e.
1. Xml based language
2. C++ code generated from 1.[Its mapping between 1 & 2]
3. compilation
4. execution.

What we have got stucked at compilation, we want that our user should
not take care about compilation or c++ code generation etc...They just
write some xml "code" and it should execute !



[snip]


嗯,使用编译器怎么样?如果您不想自己编写,

需要一段时间,您可以联系编译器供应商获取

目标平台并获得包含的许可证编译器进入你的
包并从脚本或其他东西调用它。除此之外,您可以

记录对C ++编译器的需求并在安装

您的程序时对其进行测试。

Best


Kai-Uwe Bux

[snip]

Well, what about using a compiler? If you don''t want to write your own,
which would take a while, you could contact a compiler vendor for the
target platform and obtain a license to include a compiler into your
package and call it from a script or something. Other than that, you could
document the need for a C++ compiler and test for it during installation of
your program.
Best

Kai-Uwe Bux


31 mayo,22:51,Kai-Uwe Bux< jkherci ... @ gmx。 netwrote:
On 31 mayo, 22:51, Kai-Uwe Bux <jkherci...@gmx.netwrote:

Ra ... @ MyKavita.com写道:
Ra...@MyKavita.com wrote:


Hi,


我们正在设计一些东西,它们将生成c ++程序

我们想要的是我们想要执行生成的代码。 ...
we are designing some stuff , that will generate c++ program(s)
What we want is we wanted to execute that generated code....


ie

1.基于Xml的语言

2.生成的C ++代码来自1. [它在1和1之间的映射2]

3.编译

4.执行。
i.e.
1. Xml based language
2. C++ code generated from 1.[Its mapping between 1 & 2]
3. compilation
4. execution.


我们在编译时遇到了什么,我们希望我们的用户应该

不要关心编译或c ++代码生成等......他们只是写了一些xml代码。它应该执行!
What we have got stucked at compilation, we want that our user should
not take care about compilation or c++ code generation etc...They just
write some xml "code" and it should execute !



[snip]


嗯,使用编译器怎么样?如果您不想自己编写,

需要一段时间,您可以联系编译器供应商获取

目标平台并获得包含的许可证编译器进入你的
包并从脚本或其他东西调用它。除此之外,你可以

记录需要一个C ++编译器,并在安装

你的程序时测试它。


最好


Kai-Uwe Bux


[snip]

Well, what about using a compiler? If you don''t want to write your own,
which would take a while, you could contact a compiler vendor for the
target platform and obtain a license to include a compiler into your
package and call it from a script or something. Other than that, you could
document the need for a C++ compiler and test for it during installation of
your program.

Best

Kai-Uwe Bux



好​​吧,我想你有学习.net替代方案。如果没有,.net有

库将代码编译成公共语言代码(类似于

java字节码,但是以exe或dll形式),并且做了一个c ++ / c#parser

和编译器非常简单。

在一个项目中,我使用c#作为脚本语言,编译后执行了
运行。


我希望这能帮助你。

Well, I suppose that you have study .net alternative. If not, .net has
libraries to compile a code into common language code (something like
java bytecode, but in an exe or dll form), and to do a c++/c# parser
and compiler is pretty easy.
In a project I used c# as script language, which was compiled and
executed in runtime.

I hope that this help you.


5月31日晚上10:51,Kai-Uwe Bux< ; jkherci ... @ gmx.netwrote:
On May 31, 10:51 pm, Kai-Uwe Bux <jkherci...@gmx.netwrote:

Ra ... @ MyKavita.com写道:
Ra...@MyKavita.com wrote:


我们正在设计一些东西,它们将生成c ++

程序我们想要的是我们想要执行的那些

生成代码....
we are designing some stuff , that will generate c++
program(s) What we want is we wanted to execute that
generated code....


ie

1.基于Xml的语言

2.从1.生成的C ++代码1& 2]

3.编译

4.执行。
i.e.
1. Xml based language
2. C++ code generated from 1.[Its mapping between 1 & 2]
3. compilation
4. execution.


我们在编译时遇到了什么,我们想要的是我们的

用户不应该关注编译或c ++代码

generation等...他们只是写一些xml代码。并且它应该执行

What we have got stucked at compilation, we want that our
user should not take care about compilation or c++ code
generation etc...They just write some xml "code" and it
should execute !


[snip]
[snip]


嗯,什么关于使用编译器?如果您不想自己编写
,这需要一段时间,您可以联系目标平台的

编译器供应商并获得许可证

将编译器包含在您的包中并从

脚本中调用它。除此之外,您可以记录C ++编译器需要的

,并在安装

程序时对其进行测试。
Well, what about using a compiler? If you don''t want to write
your own, which would take a while, you could contact a
compiler vendor for the target platform and obtain a license
to include a compiler into your package and call it from a
script or something. Other than that, you could document the
need for a C++ compiler and test for it during installation of
your program.



真正的问题是为什么他们会坚持使用C ++进行第2步。

机器生成的代码似乎不太可能来自用户写入XML的
需要C ++的所有功能。除非他们确实需要优化编译的速度,否则我可能只是发明了。某种内部语言可以很容易地从XML中生成,2)易于解析,3)易于有效地解释
。 (所说的语言可能甚至不支持

文本作为源格式。)


-

James Kanze(GABI软件)电子邮件:ja ********* @ gmail.com

Conseils eninformatiqueorientéeobjet/

Beratung in objektorientierter Datenverarbeitung

9个地方Sémard,78210 St.-Cyr-l''cocole,法国,+ 33(0)1 30 23 00 34

The real question is why they would insist on C++ for step 2.
It seems highly unlikely that machine generated code from user
written XML would require all of the power of C++. Unless they
really needed the speed of an optimized compilation, I''d
probably just "invent" some sort of internal language that was
1) easy to generate from XML, 2) easy to parse, and 3) easy to
interpret effectively. (Said language might not even support
text as a source format.)

--
James Kanze (GABI Software) email:ja*********@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l''école, France, +33 (0)1 30 23 00 34


这篇关于即时编译和执行C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆