Need Information on how to create bytecode

"megavlad@gmail" <megavlad@gmail.com>
8 Apr 2006 17:10:45 -0400

          From comp.compilers

Related articles
Need Information on how to create bytecode megavlad@gmail.com (megavlad@gmail) (2006-04-08)
Re: Need Information on how to create bytecode Juergen.Kahrs@vr-web.de (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2006-04-09)
Need Information on how to create bytecode ojh16@student.canterbury.ac.nz (Oliver Hunt) (2006-04-09)
Re: Need Information on how to create bytecode haberg@math.su.se (2006-04-09)
Re: Need Information on how to create bytecode Satyam@satyam.com.ar (Satyam) (2006-04-12)
Re: Need Information on how to create bytecode scavadini@ucse.edu.ar (2006-04-12)
Re: Need Information on how to create bytecode amedlock@gmail.com (DavidM) (2006-04-14)
[3 later articles]
| List of all articles for this month |
From: "megavlad@gmail" <megavlad@gmail.com>
Newsgroups: comp.compilers
Date: 8 Apr 2006 17:10:45 -0400
Organization: Compilers Central
Keywords: interpreter, question
Posted-Date: 08 Apr 2006 17:10:45 EDT

Looked for days in google, here, everywhere. Theres alot of
informaltion here about virtual machines, but I don't think anyone
actually has pointed to some tutorials show how to create bytecode or
what the structure of bytecode is.


Some info.


My goal is to create a scripting language which I can use to make 3d
video games. I know OpenGL, C++. I have already created a parser and
lexer using Bison and Flex for my language. I have also created the
framework for the graphics in C++ and OpenGL. But I'm stuck now. I can
parse my language, check for syntax erros, insert information into
symbol tables... that kind of stuff. But that's it. Now I want to to
turn my source language into Bytecode and then interpret that bytecode
(for instance, load a 3d model, print to the screen, etc).


I'm not familiar with the structure of bytecode. I know that there
isn't just one kind of bytecode, but I'm sure that alot of them share
many similarities. I'm sure the have some type of header, maybe
followed by the globals they the hard coded values, that kind of
stuff.I've read here that it's a stream of 8 bit values (sometimes 16
bits), which has instructions that jump to a given set of other
instructions; and other explanations which are TOO abstract for me. I
mean, I'm so eager to translate my source language into bytecode, yet
have no idea where to start. For instance, if I have this is my source
language:


$someValue = 1 + 2;


What does that look like in bytecode? What about:


$i = true;
if($i)
    $otherValue = someFunction();
else
    $otherValue = "Not true";




There is a hard coded string here, so I figure that somehow it has to
be inside the bytecode file. I read alot about JIT compiling, yet
don't know how it relates to bytecode. And forget it, once I, at
least, learn how I can structure my source program into a bytecode
file, I'm gonna have to tackle interpreting the actual bytecode in my
vm(which doens't yet exists).


So many questions, so many questions. I appreciate ANY input.


Thanks


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.