1. Re: EuOS (was: 2 Pass Binder)

MI>You say you have an Euphoria compiler...that may be something to take up
MI>w/Rob about using that instead of the binder.  Also, wouldn't that allow for
MI>Eu .ew libraries to be made into DLLs?  If not, would it be possible to take
MI>plain Eu code and turn it into a DLL?  I suppose if not then somebody could
MI>create an Eu --> C coverter and then DLL it, but then you'd need a C
MI>compiler, which costs $.

MI>Mike Hurley

MI>________________________________________________________
MI>NetZero - We believe in a FREE Internet.  Shouldn't you?
MI>Get your FREE Internet Access and Email at
MI>http://www.netzero.net/download/index.html

Compiled Euphoria is really made up of an assembly like language called
Euphoria Assembly and a bytecode file format. Euphoria assembly blends
the high-level features of Euphoria with the low-level features of
Assembly. For example, there are sequence operations in Euphoria
assembly, but no loops (you have to use jumps). For example:

.variables
a
b
result
.code
setrv result -- set result variable to result
mov a, {} -- a = {}
mov b, 0 -- b = 0
loop:
add b, 1 -- b += 1
append a, b -- a = append(a,b)
cl b, 5  -- result = (b < 5)
cjmp loop, result -- jump to loop if result is true (b < 5)
-- now a = {1,2,3,4,5}, b = 5, and result = 1

I've written a compiler (or perhaps the correct term would be assembler)
for Euphoria assembly in Euphoria which converts a Euphoria assembly
program like the above example into a series of bytecodes (and it also
formats it to specify the number of variables and routines, then each
routine, then the code). The bytecode file format is basically like
this:
nvariables
nroutines
lengthofroutine1
routine1.opcode1 arg1 arg2...
...
lengthofcode
code.opcode1 arg1 arg2...

Each variable above is stored in the following format:
type (byte)
data (1 or more bytes)

There are several types: BYTE, WORD, DWORD, NEGBYTE, NEGWORD, NEGDWORD,
FLOAT32, and SEQUENCE. Depending on the type, the data is interpreted in
differnt ways which I won't discuss here. You can download all the
documentation and source code from my web site:

http://members.aol.com/~JJProg/compiledeu.html

So far, I have an assembler, an interpeter in Euphoria, and two
interpreters in C++ (both are buggy, the newer one is supposed to be
faster, but it is much too buggy). I'm not too good at writing
interpreters, though, as the following benchmark shows:

Sieve benchmark:
ex.exe by RDS: 3000+ sieves/sec
my interpreter in C++: 450 sieves/sec
my interpreter in Euphoria: 82 sieves/sec

If anyone would like to help, that would be great. I would like to write
a Euphoria to Euphoria Assembly translator if I can get my bytecode
interpreter to outperform ex.exe (probably just wishful thinking, but I
think interpreting bytecodes could go much faster than interpreting
source code.)

If anyone wants to write a program that uses Euphoria Assembly, or they
want to improve it, please e-mail me so I can keep my documentation up
to date.

Jeffrey Fielding
JJProg at cyberbury.net
http://members.tripod.com/~JJPro

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu