473,811 Members | 3,300 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

On-the-fly compilation and execution of C++ program

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

Jun 27 '08 #1
16 4270
Ra***@MyKavita. com wrote:
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]

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
Jun 27 '08 #2
On 31 mayo, 22:51, Kai-Uwe Bux <jkherci...@gmx .netwrote:
Ra...@MyKavita. com wrote:
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]

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
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.
Jun 27 '08 #3
On May 31, 10:51 pm, Kai-Uwe Bux <jkherci...@gmx .netwrote:
Ra...@MyKavita. com wrote:
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]
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.
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 objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #4
On Jun 1, 5:05 am, James Kanze <james.ka...@gm ail.comwrote:
On May 31, 10:51 pm, Kai-Uwe Bux <jkherci...@gmx .netwrote:
Ra...@MyKavita. com wrote:
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]
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.

The real question is why they would insist on C++ for step 2.
James, This is interesting point, we are at very early stage, and for
step 1 & 2, there is Boost library available (we know still it is not
very much straight forward job and it may require some dirty hacks, we
think it will be more easy.)
It seems highly unlikely that machine generated code from user
written XML would require all of the power of C++. Unless they
no, we may not require all the power of c++, you can say like XML is
like domain specific language that our developer want to execute, but C
++ code will be generated in middle, and finally bytecode/machinecode/
ELF32 etc...
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.)
We do think instead of generating new languages for optimized
compilation, its good idea not to re-invent wheel.(we may be wrong and
we are very early stage of poc, we may do something very much
diffenetly.)
>
--
James Kanze (GABI Software) email:james.ka. ..@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
-Raxit Sheth
Jun 27 '08 #5

"Ra***@MyKavita .com" <ra************ @gmail.comwrote in message
news:20******** *************** ***********@p25 g2000pri.google groups.com...
On Jun 1, 5:05 am, James Kanze <james.ka...@gm ail.comwrote:
On May 31, 10:51 pm, Kai-Uwe Bux <jkherci...@gmx .netwrote:
Ra...@MyKavita. com wrote:
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 !
IMO I wouldnt worry about generating C++ code and use an intermediate
language :

JVM cross platform

http://en.wikipedia.org/wiki/Java_Virtual_Machine

For .Net (windows targets) use CLR :

http://en.wikipedia.org/wiki/Common_Language_Runtime

(See also LINQ which has AFAIK some nice XML facilities)
http://msdn.microsoft.com/en-gb/library/bb308960.aspx

Or LLVM cross platform

http://llvm.org/

regards
Andy Little

Jun 27 '08 #6
On Jun 1, 5:21 pm, "Ra...@MyKavita .com" <raxitsheth2... @gmail.com>
wrote:
On Jun 1, 5:05 am, James Kanze <james.ka...@gm ail.comwrote:
On May 31, 10:51 pm, Kai-Uwe Bux <jkherci...@gmx .netwrote:
Ra...@MyKavita. com wrote:
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]
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.
The real question is why they would insist on C++ for step 2.
James, This is interesting point, we are at very early stage,
and for step 1 & 2, there is Boost library available (we know
still it is not very much straight forward job and it may
require some dirty hacks, we think it will be more easy.)It
seems highly unlikely that machine generated code from user
written XML would require all of the power of C++. Unless
they
no, we may not require all the power of c++, you can say like
XML is like domain specific language that our developer want
to execute, but C ++ code will be generated in middle, and
finally bytecode/machinecode/ ELF32 etc...
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.)
We do think instead of generating new languages for optimized
compilation, its good idea not to re-invent wheel.(we may be
wrong and we are very early stage of poc, we may do something
very much diffenetly.)
If you need the optimization, generating C or C++, then using an
optimizing compiler, is certainly a good solution. If you don't
need that much optimization, however: my point is that it is
probably just as easy to generate a simple byte code as it is
C++, and to execute that immediately.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #7
James Kanze wrote:
If you need the optimization, generating C or C++, then using an
optimizing compiler, is certainly a good solution. If you don't
need that much optimization, however: my point is that it is
probably just as easy to generate a simple byte code as it is
C++, and to execute that immediately.
Or you could just generate javascript source code, as you can get a
javascript engine that is inexpensive (free, even) and relatively small.

http://www.digitalmars.com/dscript/index.html

Yes, I wrote it.

-----------------
Walter Bright
Digital Mars
http://www.digitalmars.com C, C++, D programming language compilers
Jun 27 '08 #8
On Jun 2, 7:47 am, Walter Bright <wal...@digital mars-nospamm.com>
wrote:
James Kanze wrote:
If you need the optimization, generating C or C++, then
using an optimizing compiler, is certainly a good solution.
If you don't need that much optimization, however: my point
is that it is probably just as easy to generate a simple
byte code as it is C++, and to execute that immediately.
Or you could just generate javascript source code, as you can
get a javascript engine that is inexpensive (free, even) and
relatively small.
http://www.digitalmars.com/dscript/index.html
That's actually a very good suggestion. Javascript, perl,
python, and probably a couple of other languages have
interpreters which you can directly link into a C++ program.
Generating one of those languages is probably no more difficult
than generating C++, and you don't have to worry about the
interpreter. (Even Perl could be used here: readability isn't a
real consideration for machine generated code.)

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #9
On May 31, 9:34*pm, "Ra...@MyKavita .com" <raxitsheth2... @gmail.com>
wrote:
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]
For these first two steps something like Cog could be used:
http://nedbatchelder.com/code/cog/
(unfortunately the website is down at the moment). I have used this
with Cheetah:
http://www.cheetahtemplate.org/
to generate C++ code from XML descriptions. Cheetah could also be used
on its own to generate C++ from XML.

Saul
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3519
by: Chris Krasnichuk | last post by:
Hello every one, Does anyone know how to make php work on your computer? please reply I need help Chris
20
11679
by: Chris Krasnichuk | last post by:
hello, Does anyone know how I make php work on "my" computer? I made a mistake in my last post so I fixed it here. Chris
2
3719
by: Patricia | last post by:
I am a new Oracle user. I am trying to install Oracle 9i Personal Edition on Windows ME; however, I am getting the following error during the installation: Oracle Database Configuration Assistant failed during install. Error message: java.lang.NoClassDefFoundError: com/inprise/vbroker/CORBA/ObjectException in thread "main" at oracle.sysman.assistants.dbca.backend.Host.<init>(Host.java:437) at...
57
25535
by: Bing Wu | last post by:
Hi all, I am running a database containing large datasets: frames: 20 thousand rows, coordinates: 170 million row. The database has been implemented with: IBM DB2 v8.1
1
1395
by: gndzkdr | last post by:
hi all, i m new on Sql and i have a project related to C# and Sql. i have to do a project which must work on LAN, and there must be only one database file on main computer(Server Computer) and other computers(client computers) must connect database on main computer. i m preparing my project on my personal computer(it is called MYCOMP) and doing connection with wizard. then it doesnt work on other
7
3976
by: SHC | last post by:
I'm in need of some javascript to load two pages into two seperate iframes which are on two seperate and different pages. Rather complicated I know (and easier done in one frameset), but caused by some limitation issues of SharePoint. To help:
8
7657
by: PhongPham | last post by:
Hello, Info relate: OS : uclinux Platform : unix version 2.4.22 (or 2.4.26) Chip on board : ARM7 I want to get a python package on network to "make" in linux (Fedora core 1 or anything if it maybe done) and run python on board with above info .After I made package 2.2.3 and 2.5.2 of Python, I tried run on board such: ./python <script> with <script> is a script file and get error : BINFMT_FLAT: bad magic/rev (0x1010100, need...
8
9389
by: Lemune | last post by:
Hi, I'm developing window service application on C# 2005. The service is to read a new excel file on certain directory, and process it to database. The service work find on XP. But when I install the application on Windows Server 2003, when i start the service it said: "The <my serviceon Local Computer started and then stop. Some service stop automatically if they have no work to do , for example ,
19
4231
by: pmw | last post by:
Hi I've got a problem with my current application. I currently use Windows Vista with Visual Studio Express 2008. If I compile the application on Vista, it works fine on Vista, but it doesn't work on XP. If I compile it on XP (with the same source code ), it runs without any problems. The thing is: I only have a virtual machine to test my software on XP, but I can't develop on it.
16
2900
by: tvnaidu | last post by:
I have these two ON and OFF buttons html code below, based on condition I am displaying status on screen(I have mutliple lines for each LED), my row shifting when some displaying ON and some displaying OFF, because ON button is smaller than OFF (ON is 2 character and OFF is 3 character), Is there anyway I can specify for both should take fixed length?. <input type="button" value="ON " style="background-color: #00cc00; color: #ffffff;" /> ...
0
9607
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10395
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10408
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9211
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5561
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5700
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3874
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3026
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.