<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><SPAN><BR class=yui-cursor></SPAN></div>
<div><BR></div>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV dir=ltr><FONT size=2 face=Arial>----- Forwarded Message -----<BR><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Hugh Aguilar &lt;hughaguilar96@yahoo.com&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Stephen Bloch &lt;bloch@adelphi.edu&gt; <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, September 26, 2012 8:07 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [racket] assembly language<BR></FONT></DIV><BR>
<DIV id=yiv928292399>
<DIV>
<DIV style="BACKGROUND-COLOR: #fff; FONT-FAMILY: times new roman, new york, times, serif; COLOR: #000; FONT-SIZE: 12pt">
<DIV><SPAN>You are right that a threaded Forth doesn't need to do any assembly --- it just "compiles" pointers to functions (code field addresses) in a thread. This can and has been done with traditional assemblers such as HLA. I'm not interested in that though.</SPAN></DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN></SPAN>&nbsp;</DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN>I want to generate machine-code functions. This involves assembling at run-time (for the forth system, which is compile-time for the Forth application program).</SPAN></DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN></SPAN>&nbsp;</DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN>I don't really understand JIT. I suppose the idea is to save memory by compiling the program as threaded code (which is much smaller than machine-code), but to convert this into machine-code "just in time" for it to run. I suppose this involves pasting together the code from all of those sub-functions in the threaded stream to create a sequence of machine-code. It seems like this conversion would take so much time that it would outweigh any speed advantage of running machine-code rather than threaded code. It must work somehow though, as it seems to be done quite a lot (the JVM for example).</SPAN></DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN></SPAN>&nbsp;</DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN>I'm not planning on JIT (especially as I don't understand it). I just want the compiler to assemble actual text source-code rather than paste together code snippets, which I am finding to be a hassle. This will be done at compile-time for the Forth application --- at run-time the Forth application just runs.</SPAN></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><VAR id=yiv928292399yui-ie-cursor></VAR>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV style="FONT-FAMILY: times new roman, new york, times, serif; FONT-SIZE: 12pt">
<DIV dir=ltr><FONT size=2 face=Arial>
<DIV style="BORDER-BOTTOM: #ccc 1px solid; BORDER-LEFT: #ccc 1px solid; PADDING-BOTTOM: 0px; LINE-HEIGHT: 0; MARGIN: 5px 0px; PADDING-LEFT: 0px; PADDING-RIGHT: 0px; HEIGHT: 0px; FONT-SIZE: 0px; BORDER-TOP: #ccc 1px solid; BORDER-RIGHT: #ccc 1px solid; PADDING-TOP: 0px" class=yiv928292399hr></DIV><B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Stephen Bloch &lt;bloch@adelphi.edu&gt;<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Hugh Aguilar &lt;hughaguilar96@yahoo.com&gt; <BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> Tony Garnock-Jones &lt;tonyg@ccs.neu.edu&gt;; "users@racket-lang.org" &lt;users@racket-lang.org&gt; <BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Tuesday, September 25, 2012 5:12 PM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [racket] assembly language<BR></FONT></DIV><BR>
<DIV id=yiv928292399>
<DIV>
<DIV><SPAN class=yiv928292399Apple-style-span>On Sep 25, 2012, at 7:38 PM, Hugh Aguilar &lt;<A href="mailto:hughaguilar96@yahoo.com" rel=nofollow target=_blank ymailto="mailto:hughaguilar96@yahoo.com">hughaguilar96@yahoo.com</A>&gt; wrote:</SPAN><BR></DIV>
<DIV><BR></DIV>
<DIV></DIV>
<BLOCKQUOTE type="cite">
<DIV>
<DIV style="BACKGROUND-COLOR: #fff; FONT-FAMILY: times new roman, new york, times, serif; COLOR: #000; FONT-SIZE: 12pt">
<DIV><SPAN class=yiv928292399Apple-style-span>I am writing a Forth system. I want it to be interactive in the usual Forth way. This means assembling a function at run-time and immediately being able to run the assembled function.</SPAN></DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN></SPAN>&nbsp;</DIV>
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN>... I'm much better off if I can just assemble the functions at run-time for the Forth system (which is compile-time for the user's Forth program).</SPAN></DIV></DIV></DIV></BLOCKQUOTE>
<DIV><BR></DIV><SPAN class=yiv928292399Apple-style-span>The traditional way to implement a Forth compiler, IIUC, &nbsp;isn't to generate executable machine code at all, but rather to generate a sequence of word-references that are interpreted as procedure calls by the Forth interpreter (which is in native executable code, but written in advance).</SPAN> 
<DIV><SPAN class=yiv928292399Apple-style-span><BR></SPAN></DIV>
<DIV><SPAN class=yiv928292399Apple-style-span>Or are you talking about some kind of JIT compiler?<BR><BR>Stephen Bloch 
<DIV><A href="mailto:sbloch@adelphi.edu" rel=nofollow target=_blank ymailto="mailto:sbloch@adelphi.edu">sbloch@adelphi.edu</A></DIV>
<DIV><BR></DIV>
<DIV>who last implemented a Forth system in 1983; I presume things have changed since then!</DIV></SPAN>
<BLOCKQUOTE type="cite">
<DIV>
<DIV style="BACKGROUND-COLOR: #fff; FONT-FAMILY: times new roman, new york, times, serif; COLOR: #000; FONT-SIZE: 12pt">
<DIV style="BACKGROUND-COLOR: transparent; FONT-STYLE: normal; FONT-FAMILY: times new roman, new york, times, serif; COLOR: rgb(0,0,0); FONT-SIZE: 16px"><SPAN></SPAN></DIV></DIV></DIV></BLOCKQUOTE></DIV></DIV></DIV><BR><BR></DIV></DIV></DIV></DIV></DIV><BR><BR></DIV></DIV></div></body></html>