2000Q1/
<!-- MHonArc v2.4.4 -->
<!--X-Subject: Re: [MUD&#45;Dev] Storing tokens with flex &#38; bison -->
<!--X-From-R13: "Xba O. Znzoreg" <wyflfvapNvk.argpbz.pbz> -->
<!--X-Date: Sun, 02 Jan 2000 19:25:46 &#45;0800 -->
<!--X-Message-Id: 004001bf5587$c9c8f700$020101df@JonLambert -->
<!--X-Content-Type: text/plain -->
<!--X-Head-End-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>MUD-Dev message, Re: [MUD-Dev] Storing tokens with flex &amp; bison</title>
<!-- meta name="robots" content="noindex,nofollow" -->
<link rev="made" href="mailto:jlsysinc#ix,netcom.com">
</head>
<body background="/backgrounds/paperback.gif" bgcolor="#ffffff"
      text="#000000" link="#0000FF" alink="#FF0000" vlink="#006000">

  <font size="+4" color="#804040">
    <strong><em>MUD-Dev<br>mailing list archive</em></strong>
  </font>
      
<br>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
<br clear=all><hr>
<!--X-Body-Begin-->
<!--X-User-Header-->
<!--X-User-Header-End-->
<!--X-TopPNI-->

Date:&nbsp;
[&nbsp;<a href="msg00026.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00027.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Thread:&nbsp;
[&nbsp;<a href="msg00122.html">Previous</a>
&nbsp;|&nbsp;<a href="msg00121.html">Next</a>
&nbsp;]
&nbsp;&nbsp;&nbsp;&nbsp;
Index:&nbsp;
[&nbsp;<A HREF="author.html#00028">Author</A>
&nbsp;|&nbsp;<A HREF="#00028">Date</A>
&nbsp;|&nbsp;<A HREF="thread.html#00028">Thread</A>
&nbsp;]

<!--X-TopPNI-End-->
<!--X-MsgBody-->
<!--X-Subject-Header-Begin-->
<H1>Re: [MUD-Dev] Storing tokens with flex &amp; bison</H1>
<HR>
<!--X-Subject-Header-End-->
<!--X-Head-of-Message-->
<UL>
<LI><em>To</em>: &lt;<A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A>&gt;</LI>
<LI><em>Subject</em>: Re: [MUD-Dev] Storing tokens with flex &amp; bison</LI>
<LI><em>From</em>: "Jon A. Lambert" &lt;<A HREF="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</A>&gt;</LI>
<LI><em>Date</em>: Sun, 2 Jan 2000 20:13:24 -0500</LI>
<LI><em>Reply-To</em>: <A HREF="mailto:mud-dev#kanga,nu">mud-dev#kanga,nu</A></LI>
<LI><em>Sender</em>: <A HREF="mailto:mud-dev-admin#kanga,nu">mud-dev-admin#kanga,nu</A></LI>
</UL>
<!--X-Head-of-Message-End-->
<!--X-Head-Body-Sep-Begin-->
<HR>
<!--X-Head-Body-Sep-End-->
<!--X-Body-of-Message-->
<PRE>
Christer Enfors wrote:
&gt;On Sat, 1 Jan 2000, Jon A. Lambert wrote:
&gt;&gt; Christer Enfors wrote:
&gt;&gt; On Sat, 1 Jan 2000, Chris Turner wrote:
&gt;&gt; &gt;&gt; 
&gt;&gt; &gt;&gt; The O'Reilly Lex &amp; Yacc book is well written and contains many tutorials.
&gt;&gt; &gt;
&gt;&gt; &gt;Right, but it doesn't have a tutorial that involves storing the source
&gt;&gt; &gt;code in any format for later execution, which is what I'm looking for in
&gt;&gt; &gt;this case.
&gt;&gt; 
&gt;&gt; 
&gt;&gt; Nod.  In order to use a byte code, one must first design and implement
&gt;&gt; a virtual machine, or target it for an existing VM (i.e. Java)
&gt;&gt; I think what you are looking for is documentation on designing Virtual
&gt;&gt; Machines.  The way I learned was by snooping through all the notes,
&gt;&gt; examples, and syllabus (syllabi?) left out on the net by university professors
&gt;&gt; teaching it.  For some reason the CS course numbers (505 and 565) seem
&gt;&gt; familar, though it has been a couple years.  :-( 
&gt;&gt; There's Sun's Java VM doc, the Smart tiny VM, the Luck VM, the ANTLR 
&gt;&gt; tutorial by Scott Stanchfield(?) that implements a language called
&gt;&gt; X.  I don't know offhand of any books that cover VM design in depth.  
&gt;
&gt;Ah, now the pieces are starting to fall into place.
&gt;
&gt;I am not supposed to use lex &amp; yacc for the execution at all, am I? I
&gt;thought I was. 

Well, Bison can act as an executable interpreter, but it's probably not an
ideal vehicle for processing a mud programming language/script.
Also, you might want to take a look at the Interlude server.  I think Chris has
a copy on ftp.kanga.nu.  Interlude uses lex as a scanner but implements
an RD parser by hand.   

&gt;All I should use lex &amp; yacc for is the source code to byte
&gt;code compilation, right? And since my byte code is so clever / simple, I
&gt;can code the VM manually in C, without needing lex &amp; yacc? Am I on the
&gt;right track now? =)

Yes. :-)  BTW, writing scanners and recusive descent parsers is easy.
Definitely read the Crenshaw tutorial.   The CoolMUD VM is a simple
and well-written example of a VM.

Like JC Lawrence and Chris Gray I've written my own scanners and recursive 
descent parsers.  Personally, I'm a bit anal about not using globals, having 
readable and debugable code.  Yacc and Bison generate extremely ugly
code.  

On the other hand, ANTLR (formerly PCCTS) generates fairly readable and 
passable object-oriented C++ code.  I wrote the grammar for Aphrodite using
ANTLR and debugged it using ANTLR's Parseview tool.  ANTLR's notation 
is better than Bison/Yacc because you can write a handmade RDP by hand 
by just looking at the grammar notation itself.   Crenshaw talks about how to do 
this with BNF notation.  Bison/yacc grammars use very confusing notations to
show precedence and resolve syntax conflicts.    

Oh and here's the link to Stanchfield's XL compiler/Antlr tutorial :
&lt;URL: <A  HREF="http://www.javadude.com/articles/antlrtut/">http://www.javadude.com/articles/antlrtut/</A>&gt;


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





_______________________________________________
MUD-Dev maillist  -  MUD-Dev#kanga,nu
<A  HREF="http://www.kanga.nu/lists/listinfo/mud-dev">http://www.kanga.nu/lists/listinfo/mud-dev</A>

</PRE>

<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<HR>
<ul compact><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><A NAME="00121" HREF="msg00121.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>
<ul compact><li><em>From:</em> J C Lawrence &lt;claw#kanga,nu&gt;</li></ul>
</UL></LI></UL>
<!--X-Follow-Ups-End-->
<!--X-References-->
<!--X-References-End-->
<!--X-BotPNI-->
<UL>
<LI>Prev by Date:
<STRONG><A HREF="msg00026.html">[MUD-Dev] concerning tokenization, compilation, performance, and other fun stuff.</A></STRONG>
</LI>
<LI>Next by Date:
<STRONG><A HREF="msg00027.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></STRONG>
</LI>
<LI>Prev by thread:
<STRONG><A HREF="msg00122.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></STRONG>
</LI>
<LI>Next by thread:
<STRONG><A HREF="msg00121.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></STRONG>
</LI>
<LI>Index(es):
<UL>
<LI><A HREF="index.html#00028"><STRONG>Date</STRONG></A></LI>
<LI><A HREF="thread.html#00028"><STRONG>Thread</STRONG></A></LI>
</UL>
</LI>
</UL>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
<ul><li>Thread context:
<BLOCKQUOTE><UL>
<LI><STRONG>Re: [MUD-Dev] Storing tokens with flex &amp; bison</STRONG>, <EM>(continued)</EM>
<ul compact>
<ul compact>
<LI><strong><A NAME="00022" HREF="msg00022.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
Greg Miller <a href="mailto:gmiller#classic-games,com">gmiller#classic-games,com</a>, Sun 02 Jan 2000, 17:26 GMT
</LI>
</ul>
<LI><strong><A NAME="00023" HREF="msg00023.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
cg <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Sun 02 Jan 2000, 18:08 GMT
<UL>
<LI><strong><A NAME="00024" HREF="msg00024.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
Kevin Littlejohn <a href="mailto:darius#connect,com.au">darius#connect,com.au</a>, Sun 02 Jan 2000, 18:42 GMT
</LI>
<LI><strong><A NAME="00122" HREF="msg00122.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Tue 18 Jan 2000, 09:02 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00028" HREF="msg00028.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
Jon A. Lambert <a href="mailto:jlsysinc#ix,netcom.com">jlsysinc#ix,netcom.com</a>, Mon 03 Jan 2000, 03:25 GMT
<UL>
<LI><strong><A NAME="00121" HREF="msg00121.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
J C Lawrence <a href="mailto:claw#kanga,nu">claw#kanga,nu</a>, Tue 18 Jan 2000, 08:55 GMT
</LI>
</UL>
</LI>
<LI><strong><A NAME="00027" HREF="msg00027.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
cg <a href="mailto:cg#ami-cg,GraySage.Edmonton.AB.CA">cg#ami-cg,GraySage.Edmonton.AB.CA</a>, Mon 03 Jan 2000, 03:25 GMT
<UL>
<LI><strong><A NAME="00066" HREF="msg00066.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
Phillip Lenhardt <a href="mailto:philen#funky,monkey.org">philen#funky,monkey.org</a>, Fri 07 Jan 2000, 21:56 GMT
<UL>
<LI><strong><A NAME="00067" HREF="msg00067.html">Re: [MUD-Dev] Storing tokens with flex &amp; bison</A></strong>, 
Dominic J. Eidson <a href="mailto:sauron#the-infinite,org">sauron#the-infinite,org</a>, Fri 07 Jan 2000, 22:35 GMT
</LI>
</UL>
</LI>
</UL>
</LI>
</ul>
</LI>
</UL></BLOCKQUOTE>

</ul>
<hr>
<center>
[&nbsp;<a href="../">Other Periods</a>
&nbsp;|&nbsp;<a href="../../">Other mailing lists</a>
&nbsp;|&nbsp;<a href="/search.php3">Search</a>
&nbsp;]
</center>
<hr>
</body>
</html>