473,387 Members | 1,481 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,387 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 2923
"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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...

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.