<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>David Vázquez</title>
  <link href="http://davazp.net"/>
  <link type="application/atom+xml" rel="self" href="http://davazp.net/feeds/atom.xml"/>
  <updated>2013-05-01T06:55:13-07:00</updated>
  <id>http://davazp.net/</id>
  <author>
    <name>David Vázquez</name>
    <email>davazp@gmail.com</email>
  </author>
  
  <entry>
    <id>http://davazp.net/2013/05/01/the-surprising-jscl-rising</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2013/05/01/the-surprising-jscl-rising.html"/>
    <title>The surprising JSCL rising</title>
    <published>2013-05-01T00:00:00-07:00</published>
    <updated>2013-05-01T00:00:00-07:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2013/05/01/the-surprising-jscl-rising</uri>
    </author>
    <content type="html">&lt;p&gt;I am just back from a few days of holidays and have seen how active
JSCL is!  It is really exciting.
&lt;/p&gt;
&lt;p&gt;
This rising is due to &lt;a href=&quot;https://github.com/abeaumont&quot;&gt;abeaumont&lt;/a&gt; probably. I stopped working, but he
came up with an idea I liked. It is, why don't integrate JSCL into
&lt;a href=&quot;http://conkeror.org/&quot;&gt;Conkeror&lt;/a&gt;? We would end up with a Lisp programmable browser&amp;hellip; that's a
practical reason!  We did some tests locally and it seemed to work,
but now it is time for improving JSCL itself.
&lt;/p&gt;
&lt;p&gt;
It is not the only platform where JSCL could run on. I plan to add
support for &lt;a href=&quot;http://nodejs.org/&quot;&gt;Node JS&lt;/a&gt;. Indeed, it will let us use the REPL and tests in
the terminal in addition to the browser, which is a much more
convenient way to program.
&lt;/p&gt;
&lt;p&gt;
In the meantime, I would like to improve the compiler a little bit.
&lt;/p&gt;
&lt;p&gt;
Suggestion and patches are very welcome if you want to join us.
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;https://github.com/davazp/jscl&quot;&gt;https://github.com/davazp/jscl&lt;/a&gt;
&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://davazp.net/2013/04/11/back-in-action</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2013/04/11/back-in-action.html"/>
    <title>Back in action</title>
    <published>2013-04-11T00:00:00-07:00</published>
    <updated>2013-04-11T00:00:00-07:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2013/04/11/back-in-action</uri>
    </author>
    <content type="html">&lt;p&gt;Hello everyone. I have been away some days from the computer, but I am
back now!  I have spent two weeks in New York visiting such a great
city. I had the opportunity to attend to a LispNYC meetup and enjoy
the great atmosphere there. I hope to come back soon.
&lt;/p&gt;
&lt;p&gt;
I have also a new laptop. Finally, I have to say, as I inherited the
last one from my brother and I have been using it for 6 years. Most of
the time it was good enough but it is becoming very annoying. For
example, I could not compile SBCL because it was restarted due to
overheating..
&lt;/p&gt;
&lt;p&gt;
I feel like doing things now so I wish I could tell you new adventures
soon.
&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://davazp.net/2013/03/06/Forth-model-illustration</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2013/03/06/Forth-model-illustration.html"/>
    <title>Forth model illustration</title>
    <published>2013-03-06T00:00:00-08:00</published>
    <updated>2013-03-06T00:00:00-08:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2013/03/06/Forth-model-illustration</uri>
    </author>
    <content type="html">&lt;p&gt;I like old systems which expose a good part of their internals,
specially when they are so simple. I created this animation using
&lt;a href=&quot;http://ditaa.sourceforge.net/&quot;&gt;ditaa&lt;/a&gt; to illustrate how execution is done in Forth:
&lt;/p&gt;
&lt;p&gt;
&lt;img src=&quot;../../../img/eulex/forth.gif&quot;  alt=&quot;../../../img/eulex/forth.gif&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
Of course, it only makes sense if you already know Forth. But I guess
you do not know many languages where such thing is possible.
&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://davazp.net/2013/01/24/Special-arguments</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2013/01/24/Special-arguments.html"/>
    <title>Special arguments</title>
    <published>2013-01-24T00:00:00-08:00</published>
    <updated>2013-01-24T00:00:00-08:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2013/01/24/Special-arguments</uri>
    </author>
    <content type="html">&lt;p&gt;I have learnt a new trick these days. Did you know that you can
declare an argument as a special variable? Quoting &lt;a href=&quot;http://www.lispworks.com/documentation/HyperSpec/Body/03_daa.htm&quot;&gt;Hyperspec&lt;/a&gt;:
&lt;/p&gt;
&lt;blockquote&gt;

&lt;p&gt;Each required parameter is specified by a parameter variable var. var
is bound as a lexical variable &lt;i&gt;unless it is declared special&lt;/i&gt;.
&lt;/p&gt;
&lt;/blockquote&gt;


&lt;p&gt;
It seems to work also for optional and keyword arguments, but
Hyperspec does not mention it explicitly. For example, yo can do:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;(defvar *variable*)
(defun foo () *variable*)
(defun foobar (&amp;amp;optional *variable*)
  (foo))
&lt;/pre&gt;

</content>
  </entry>
  
  <entry>
    <id>http://davazp.net/2013/01/04/lisp-to-javascript</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2013/01/04/lisp-to-javascript.html"/>
    <title>Lisp to Javascript compiler</title>
    <published>2013-01-04T00:00:00-08:00</published>
    <updated>2013-01-04T00:00:00-08:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2013/01/04/lisp-to-javascript</uri>
    </author>
    <content type="html">&lt;p&gt;&lt;a href=&quot;http://puntoblogspot.blogspot.ie/&quot;&gt;Raimon Grau&lt;/a&gt; and I have been working on a simple Lisp to Javascript
compiler, in order to better understand how to bootstrap it. Now we
got it. It compiles itself and the resulting code can be used from the
browser. It can even call its own internals, which is quite nice.
&lt;/p&gt;
&lt;p&gt;
It is not very helpful, you can &lt;a href=&quot;http://davazp.github.com/ecmalisp/ecmalisp.html&quot;&gt;try it&lt;/a&gt;. Now I have to think if it
could be useful for something&amp;hellip; maybe a live Lisp tutorial, or make
it suitable for Android. Any suggestions?
&lt;/p&gt;
&lt;p&gt;
The repository with the whole history is at:
&lt;/p&gt;
&lt;p&gt;
&lt;a href=&quot;http://github.com/davazp/ecmalisp/&quot;&gt;http://github.com/davazp/ecmalisp/&lt;/a&gt;
&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://davazp.net/2012/12/13/Emphasizing-text-in-ERC</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2012/12/13/Emphasizing-text-in-ERC.html"/>
    <title>Emphasizing text in ERC</title>
    <published>2012-12-13T00:00:00-08:00</published>
    <updated>2012-12-13T00:00:00-08:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2012/12/13/Emphasizing-text-in-ERC</uri>
    </author>
    <content type="html">&lt;p&gt;I have realized &lt;a href=&quot;http://www.gnu.org/software/emacs/manual/html_mono/erc.html&quot;&gt;ERC&lt;/a&gt; supports control characters to emphasize text
as &lt;b&gt;bold&lt;/b&gt;, &lt;span style=&quot;text-decoration:underline;&quot;&gt;underline&lt;/span&gt;&amp;hellip;  However, I prefer &lt;code&gt;*foo*&lt;/code&gt;, &lt;code&gt;/bar/&lt;/code&gt; and
&lt;code&gt;_foobar_&lt;/code&gt; syntax, just like org-mode and Gnus. So I have added the
following code to my .emacs to do the job:
&lt;/p&gt;



&lt;pre class=&quot;example&quot;&gt;(defun erc-emphasize ()
  (when (eq erc-interpret-controls-p t)
    (goto-char (point-min))
    (while (re-search-forward &quot;\\(?:^\\|\\s-\\)\\(\\*\\([^*]+\\)\\*\\)\\(:?$\\|\\s-\\)&quot; nil t)
      (replace-match &quot;\C-b\\2\C-o&quot; nil nil nil 1))
    (goto-char (point-min))
    (while (re-search-forward &quot;\\(?:^\\|\\s-\\)\\(_\\([^_]+\\)_\\)\\(?:$\\|\\s-\\)&quot; nil t)
      (replace-match &quot;\C-_\\2\C-O&quot; nil nil nil 1))
    (goto-char (point-min))
    (while (re-search-forward &quot;\\(?:^\\|\\s-\\)\\(/\\([^/]+\\)/\\)\\(?:$\\|\\s-\\)&quot; nil t)
      (replace-match &quot;\C-V\\2\C-O&quot; nil nil nil 1))))

(add-hook 'erc-send-pre-hook
          (lambda (string)
            (with-temp-buffer
              (insert string)
              (erc-emphasize)
              (setq str (buffer-substring (point-min) (point-max))))))

(add-hook 'erc-insert-modify-hook 'erc-emphasize)
&lt;/pre&gt;


&lt;p&gt;
The code transforms the text before sending it, so it will work
without changes in the IRC client of the other person, supposed
control characters is supported of course. If you want to send/receive
text literally, just disable control characters interpretation with
&lt;code&gt;C-c C-c&lt;/code&gt; in the ERC buffer.
&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <id>http://davazp.net/2012/12/08/eulex-forth-implementation</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2012/12/08/eulex-forth-implementation.html"/>
    <title>I wrote a Forth implementation for x86</title>
    <published>2012-12-08T00:00:00-08:00</published>
    <updated>2012-12-08T00:00:00-08:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2012/12/08/eulex-forth-implementation</uri>
    </author>
    <content type="html">&lt;p&gt;Yes, I did it, and I have to say that it was one of the most exciting
hack experiences that I have had. But let us start in the beginning,
four years ago. At that time, a friend and I was writing some toys
related to operating systems. He was a C programmer, but knowing that
nobody even will try our system, I wanted to have some extra fun!  I
convinced him to embed a Forth in the kernel. I did not know anything
about Forth, but it promised to be interesting. I picked up &lt;a href=&quot;https://mywebspace.wisc.edu/lnmaurer/web/forth/Forth-79.pdf&quot;&gt;an old specification of the Forth language&lt;/a&gt; and implement it in assembler for
x86. It became a retro-software project. However, he moved to other
projects and the project stopped.
&lt;/p&gt;
&lt;p&gt;
A couple of years later, I found the code again. I have not any other
thing to work in, so I chose to give it a try. I ported my original
implementation to 32 bits and I integrated the Forth implementation
with the C kernel. Once that I could write programs on it, I replaced
C and grew the language with many words. I wrote output routines, a
serial driver, keyboard and a video driver, memory management,
exceptions, timer&amp;hellip; It was so fun that I could not stop there and I
wrote a speaker driver, an assembler and disassembler, trace/untrace
utilities, a Sokoban game taken from &lt;a href=&quot;http://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=1&amp;amp;cad=rja&amp;amp;ved=0CDAQFjAA&amp;amp;url=http://www.gnu.org/software/gforth/&amp;amp;ei=RfK7ULjnOtKKhQf514GQBA&amp;amp;usg=AFQjCNHudHXaFa59if5FT9XqVgjGehMtfQ&quot;&gt;GForth&lt;/a&gt;, emacs keybindings and
autocompletion in the terminal like in readline, and a simple Lisp
interpreter! Did I say how great growing the system from scratch was?
&lt;/p&gt;

&lt;div id=&quot;outline-container-1&quot; class=&quot;outline-3&quot;&gt;
&lt;h3 id=&quot;sec-1&quot;&gt;Try Eulex&lt;/h3&gt;
&lt;div class=&quot;outline-text-3&quot; id=&quot;text-1&quot;&gt;

&lt;p&gt;The first thing you have to do is make sure you have a recent Qemu
installation. It has to be enough recent to support multiboot
kernels. Just installing the version of your distribution should
work. Now, get the source code from the repository
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;git clone https://github.com/davazp/eulex.git&lt;/code&gt;
&lt;/p&gt;
&lt;p&gt;
Move to the directory where it was cloned and type &lt;code&gt;make&lt;/code&gt; to
compile. In order to launch QEmu with the Eulex image, run the script
&lt;code&gt;./run-eulex.sh&lt;/code&gt;. If you pass any argument to this script, they are
passed to QEmu. It can be useful to enable sound, for example.
&lt;/p&gt;
&lt;p&gt;
At this point, the system should boot as below. You can type Forth
code right there and it will be evaluated. Indeed, you can type TAB
key to autocomplete words, or use some emacs-like keybindings, e.g: &lt;code&gt;C-a&lt;/code&gt;,
&lt;code&gt;C-e&lt;/code&gt;, &lt;code&gt;M-b&lt;/code&gt;, &lt;code&gt;M-f&lt;/code&gt;, &lt;code&gt;C-l&lt;/code&gt;&amp;hellip;
&lt;img src=&quot;../../../img/eulex/1.png&quot;  alt=&quot;../../../img/eulex/1.png&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
By default, the context provides standard Forth words, but if you want
to hack the internals you will need access to the internal
vocabulary. Use the word &lt;code&gt;eulex&lt;/code&gt; to do that. You can try to type
&lt;code&gt;words&lt;/code&gt; to list all the words in a context. In the internal
vocabulary, there are about a thousand words.
&lt;/p&gt;
&lt;p&gt;
It is possible to disassemble words, e.g: &lt;code&gt;see edit-line&lt;/code&gt;. Note that
the disassembler uses the current context to look call addresses back
into word names. If many addresses are not showing, try moving to the
eulex vocabulary.
&lt;/p&gt;
&lt;p&gt;
&lt;img src=&quot;../../../img/eulex/2.png&quot;  alt=&quot;../../../img/eulex/2.png&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
There is not persistent storage, after halting QEmu, or rebooting with
the command &lt;code&gt;reboot&lt;/code&gt;, changes will be lost. Therefore, you could want
to write code in the file &lt;code&gt;eulexrc.fs&lt;/code&gt;, which is loaded automatically
when the system starts.
&lt;/p&gt;
&lt;p&gt;
In closing, I would like to include a couple of nice pictures. The
first one is an incomplete screen block &lt;a href=&quot;https://github.com/davazp/eulex/blob/master/editor.fs&quot;&gt;editor&lt;/a&gt;,
&lt;/p&gt;
&lt;p&gt;
&lt;img src=&quot;../../../img/eulex/3.png&quot;  alt=&quot;../../../img/eulex/3.png&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
The second one is a &lt;a href=&quot;https://github.com/davazp/eulex/blob/master/lisp/lisp.fs&quot;&gt;little Lisp interpreter&lt;/a&gt;, written in Forth.
&lt;/p&gt;
&lt;p&gt;
&lt;img src=&quot;../../../img/eulex/4.png&quot;  alt=&quot;../../../img/eulex/4.png&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;
I hope you liked it. If you fancy hacking this and enjoy it as I did,
do not hesitate to write to me, I will help you with pleasure. There
many minor details, if you would like to try it but no to spend so
much time. If you feel adventurous, then the points to work are:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Bootstrapping&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Rewriting forth.S as a crosscompiler to run on GForth, the 100% of the
code would be Forth. The system could compile itself eventually. The
&lt;a href=&quot;https://github.com/davazp/eulex/blob/master/assembler.fs&quot;&gt;assembler&lt;/a&gt; I wrote can be used to this task, as it executes both in
Eulex as in GForth.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Improving the compiler&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is as native as described in this document. Code is very
inefficient. We could optimize it, but we do not want if the compiler
is written in assembler. So bootstraping should come first.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Hard disk driver and FAT implementation.&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Actually, files are stored built-in with the same Eulex image, so they
are read-only.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Dumping and restoring the world&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the floppy driver or a file system implementation is working,
dumping the dictionary to the disk would have the nice effect ot
saving the whole state of the system.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</content>
  </entry>
  
  <entry>
    <id>http://davazp.net/2012/12/01/First-post</id>
    <link type="text/html" rel="alternate" href="http://davazp.net/2012/12/01/First-post.html"/>
    <title>First post</title>
    <published>2012-12-01T00:00:00-08:00</published>
    <updated>2012-12-01T00:00:00-08:00</updated>
    <author>
      <name>David Vázquez</name>
      <uri>http://davazp.net/2012/12/01/First-post</uri>
    </author>
    <content type="html">&lt;p&gt;Hello everybody. Here it is, a new github-hosted blog. You can know
something
&lt;a href=&quot;/about.html&quot;&gt;about me&lt;/a&gt;
now, but what will this blog be about? Unsurprisingly, I will tell
different things I hack, as the main reason to open this blog is
because I do not know many people to talk about this kind of things
face-to-face. You will find some Lisp and Emacs-related posts
probably, as well as some light math, but I will post anything I find
interesting.
&lt;/p&gt;
&lt;p&gt;
The blog is quite simple. I do not provide tags yet, but I have
enabled comments on the posts, so you can give some feedback.
&lt;/p&gt;
&lt;p&gt;
Finally, I hope to share some nice things, and somebody likes
it. Also, English is not my mother tongue, so writing it requires some
extra effort, but I will do my best.
&lt;/p&gt;
&lt;p&gt;
Welcome to my blog.
&lt;/p&gt;
</content>
  </entry>
  
</feed>
