473,406 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Compiler/Virtual Machine Environment

Has anyone ever implemented embedding a "virtual host" or "virual machine"
environment inside your C/C++ programs so that end-users could write small
snippets of customized code, compile it using your custom compiler, and if
the compiled byte-code file exists, it gets loaded and ran by the embedded
virtual host engine?

My thought was to develop a basic-like compiler system that the user could
write a file called TASKA.MSC which looks like:

// File: TASKA.MSC
// Simple Task A Example
Dim userdata as TUserData
Clear userdata
if GetUserData(userdata) then
// do something with the data
// specific to this end-user install
end if

Then run this through my compiler:

mysc.exe taska.msc

This would create something like taska.mxc which is a compiled byte-code
binary file of the instructions found in the 4GL base source file. The
virtual host environment would be inclusive inside my program or a DLL which
basically is a virtual machine environment that loads the MXC file, and runs
the binary version instead of having to verify the 4GL syntax, compile it,
and then run it. All the virtual environment does is execute it (very much
like java and its JVM).

Anyone have any thoughts on:
1) How to create such a compiler
2) How to create the host environment to execute the compiled binary?

Thanks
--

Jul 22 '05 #1
4 2925
"ccrabfo" <cc*****@bellsouth.net> wrote
Has anyone ever implemented embedding a
"virtual host" or "virual machine" environment
inside your C/C++ programs so that end-users
could write small snippets of customized code,
compile it using your custom compiler, and if
the compiled byte-code file exists, it gets loaded
and ran by the embedded virtual host engine?

...

Anyone have any thoughts on:
1) How to create such a compiler
2) How to create the host environment to execute
the compiled binary?


A number of commercial and free solutions already exist. Commercial
solutions tend to emulate VBA and are fairly expensive. Free solutions
include embedding Perl, Python, LISP, or other freely available
interpreters.

If you want to implement this yourself, you'll save yourself a lot of hassle
if you write an interpreter instead of a compiler. How to do that, however,
is both off-topic for this newsgroup and beyond the reasonable scope for any
posting. You could start with the following book:
http://search.barnesandnoble.com/boo...sbn=0471597538

Claudio Puviani
Jul 22 '05 #2
"ccrabfo" <cc*****@bellsouth.net> wrote
Has anyone ever implemented embedding a
"virtual host" or "virual machine" environment
inside your C/C++ programs so that end-users
could write small snippets of customized code,
compile it using your custom compiler, and if
the compiled byte-code file exists, it gets loaded
and ran by the embedded virtual host engine?

...

Anyone have any thoughts on:
1) How to create such a compiler
2) How to create the host environment to execute
the compiled binary?


A number of commercial and free solutions already exist. Commercial
solutions tend to emulate VBA and are fairly expensive. Free solutions
include embedding Perl, Python, LISP, or other freely available
interpreters.

If you want to implement this yourself, you'll save yourself a lot of hassle
if you write an interpreter instead of a compiler. How to do that, however,
is both off-topic for this newsgroup and beyond the reasonable scope for any
posting. You could start with the following book:
http://search.barnesandnoble.com/boo...sbn=0471597538

Claudio Puviani
Jul 22 '05 #3
On Fri, 9 Apr 2004 15:11:40 -0400, ccrabfo <cc*****@bellsouth.net> wrote:
Has anyone ever implemented embedding a "virtual host" or "virual
machine"
environment inside your C/C++ programs so that end-users could write
small
snippets of customized code, compile it using your custom compiler, and
if
the compiled byte-code file exists, it gets loaded and ran by the
embedded
virtual host engine?


Don't know what your exact requirements are but you could try LUA [1]

[1] http://www.lua.org/
--
Mike Higginbottom
http://www.peak41.co.uk
Jul 22 '05 #4
On Fri, 9 Apr 2004 15:11:40 -0400, ccrabfo <cc*****@bellsouth.net> wrote:
Has anyone ever implemented embedding a "virtual host" or "virual
machine"
environment inside your C/C++ programs so that end-users could write
small
snippets of customized code, compile it using your custom compiler, and
if
the compiled byte-code file exists, it gets loaded and ran by the
embedded
virtual host engine?


Don't know what your exact requirements are but you could try LUA [1]

[1] http://www.lua.org/
--
Mike Higginbottom
http://www.peak41.co.uk
Jul 22 '05 #5

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

Similar topics

3
by: Tim Freeman | last post by:
Doing an independent study with Dave Beazley this quarter, Atul Varma has written a C compiler on his own in Python. It generates annotated x86 assembly code from arbitrary C files. Quoting...
0
by: ccrabfo | last post by:
Has anyone ever implemented embedding a "virtual host" or "virual machine" environment inside your C/C++ programs so that end-users could write small snippets of customized code, compile it using...
10
by: Bjorn | last post by:
I'm using interfaces in C++ by declaring classes with only pure virtual methods. If then someone wants to implement the interface they needs to inherit from the class. If the implementing class...
25
by: Mohd Hanafiah Abdullah | last post by:
Axiomatic Solutions Sdn Bhd announces the availability of AMPC version 1.2. You can purchase AMPC online now at: http://www.axiomsol.com/hedesu/shopping/index.php Major Changes -------------...
43
by: Minti | last post by:
Hi there everybody, I was just wondering that too many people choose to use language like Java because of its architecture independence, this AI is achieved because Java is as such a...
10
by: Ardhendu Nandan | last post by:
I am trying to compile Gcc compiler in Windows O/S.I have downloaded entire source Code of this compiler at tries to run it in DEVCPP but I am gating some linker error and some header files missing...
5
by: Stu Carter | last post by:
Hi, ENV: Windows 2003 Server SP1 (+all updates), VS 2003, .Net 1.1 SP1 We've got an ASP.Net web application using State Service. All is fine until we tried to use the app through a virtual...
16
by: Bunny.Joy | last post by:
Hi, I know that some granddaddy-level C++ compiler can compile C++ code into a C intermediate. Apart from that, however, I can not find any modern compiler to do that. And in fact, I think, this...
7
by: Henry | last post by:
I am looking for a copy of Borland C++ 5.0.1. I have a project at work that was written using this version, and cannot open the project files with a later (or an earlier) version. If you know...
0
by: ckmoied | last post by:
Hi guys, I want to know if there is any checklist available that one can follow before moving the databases from one server to another one. I am a newbie in SQL stuff and facing the following...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.