[MUD-Dev] Storing tokens with flex & bison

Jon A. Lambert jlsysinc at ix.netcom.com
Sat Jan 1 19:46:39 CET 2000


Christer Enfors wrote:
On Sat, 1 Jan 2000, Chris Turner wrote:
>
>> 
>> Well this would always work with what you have already.  It might be a bit
>> slower.  If you want a real speed increase, you would be better off compiling
>> the function into some form of byte-code, which could be run though without
>> needing to parse anything.
>
>I thought my supposed stored linked list of tokens was considered
>"byte-code", but I guess it's not that simple. Looks like I better hit the
>Dragon book some more, I bet this sort of stuff is explained in there
>somewhere.
>

That stored list would be called a pre-tokenized stream.  It's how the
old MS-Basic and C64 Basic used to save code when exiting the editor.  
You can do much better though.  The output of Bison can be:

a) An interpreter
b) Native machine code 
c) A byte code for a virtual machine 

Both b) and c) are intermediate forms of storage.  Machine code
probably needs to be linked and a byte code needs a VM to 
execute it.  The output from bison could probably be other things 
as well.  

>> 
>> The O'Reilly Lex & Yacc book is well written and contains many tutorials.
>
>Right, but it doesn't have a tutorial that involves storing the source
>code in any format for later execution, which is what I'm looking for in
>this case.


Nod.  In order to use a byte code, one must first design and implement
a virtual machine, or target it for an existing VM (i.e. Java)
I think what you are looking for is documentation on designing Virtual
Machines.  The way I learned was by snooping through all the notes,
examples, and syllabus (syllabi?) left out on the net by university professors
teaching it.  For some reason the CS course numbers (505 and 565) seem
familar, though it has been a couple years.  :-( 
There's Sun's Java VM doc, the Smart tiny VM, the Luck VM, the ANTLR 
tutorial by Scott Stanchfield(?) that implements a language called
X.  I don't know offhand of any books that cover VM design in depth.  

--
--*     Jon A. Lambert - TychoMUD Email: jlsysinc at nospam.ix.netcom.com     *--
--*     Mud Server Developer's Page <http://jlsysinc.home.netcom.com>      *--
--* "No Free man shall ever be debarred the use of arms." Thomas Jefferson *--





_______________________________________________
MUD-Dev maillist  -  MUD-Dev at kanga.nu
http://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list