HomeBlogCategory: “ymacs”

Showing only posts in category “ymacs”.

Show all

May
14
2012
01:04

SS-Lisp — run Lisp in your browser

SS-Lisp is an experiment I've worked on in my free time, rather sporadically, for several months.

It's a Lisp compiler that runs in a browser.  It compiles Lisp to an intermediary “bytecode” and it provides a virtual machine to run the compiled code with acceptable speed (I recommend Chrome or a derivative browser for “acceptable” to stand true).

It provides an “IDE” which mimics Emacs/SLIME, via my Ymacs editor.  The IDE has some interesting features, like symbol completion and cross-reference—if you used Emacs/SLIME you should feel fairly comfortable with it, though do not expect it to be that competent. ;)

I made a screen-cast here: https://vimeo.com/42070553 (that's without voice because I totally suck at making screen-casts).

While just a toy, as far as my research goes, I think it's the best one at the moment.  It beats BiwaScheme by orders of magnitude in terms of speed and development environment, and most other Lisp interpreters for the browser, including my own previous attempts, are not worth mentioning—except one, which actually inspired me to work on this: http://norstrulde.org/ilge10/.  Great job Eric!

Update: fellow from Germany suggested that I should rename the project, since the SS abbreviation brings up painful memories in some parts of the world...  I believe he's right so I'll rename it in the following days.  Any ideas for a name are welcome. :-)

Followup: done with that, the new name is “SLip”.  The old URL will redirect to the new one (slip.lisperator.net).

Jul
22
2011
01:50

Dynamic scope & lexical scope — how?

Some time back I started working on a Lisp interpreter in JavaScript.  That's because I've been going through SICP, and section 4.1 is extraordinarily inspiring—if you read that, you want to write a Scheme interpreter.  Except that, being already a Common Lisp programmer, I wanted to write a Common Lisp interpreter.  Or at least a tiny part of it.

The version that's published on Github right now has both static (lexical) and dynamic scope, but it's somewhat cheating.  To implement dynamic scope I used JavaScript's try/finally, in order to pop dynamic bindings once a LET block that established them finished execution.  However, that version has a show-stopper bug: because JavaScript doesn't have tail call optimization (and even if it would)—it ruins the stack quite easily and you can't generally do loops via recursion.

So I started a new branch (which will be on Github pretty soon); on this new version all the interpreter is implemented in “continuation-returning-style”, if I may say so—instead of calling another function, or returning a value, each expression returns a function that knows what to do next.  The evaluation means to call a function, and the returned function, and the function returned from the returned function, until the cows come home.  (trampoline-style)

This incidentally gave me call/cc “for free”, which is nice (I already gave up my dreams of implementing a subset of Common Lisp, so I'll implement a superset instead :-p).  However dynamic variables turn out to be quite a hassle now.  I don't have the luxury of using the exceptions of the underlying language, because the stack is cleared after each expression evaluates.  Somehow I need to catch the moment when a scope exits, in order to restore the dynamic variables that it modified, but I'm not quite sure how—and the problem is exaggerated by having continuations...   Grr, I'll think of it some more this weekend.

Anyway, I'll publish a toy Lisp environment, with an Ymacs demo for the browser.  Soon.  It will be totally useless for practical purposes, of course.  It can solve WOTF in 10 seconds, with a Schemeish amb macro. (100 times slower than the plain JavaScript implementation).

Update: this is it:

Still no dynamic scope.

    Dec
    19
    2009
    18:32

    The greatest programmer in the universe

    Want to know who that is?  It's me. ;-)

    I submitted my Ymacs project to Ohloh (Ymacs project page at Ohloh).  They have a nice feature that gives some statistics, based on the source code (they can understand some source control repositories, including Mercurial, which is what I use).  The Ymacs statistics say the following (the whole source taken into consideration):

    • estimated effort: 4 person-years
    • project cost: $210,926 (for a $55000/year salary)

      Counting only the JavaScript files, which is the main programming language, we have:

      • estimated effort: 1 person-years
      • project cost: $61,739 (same $55000/year salary)

      The fact is: I did this myself in a bit more than 2 months (work on the website and infrastructure included).

      It's true that Ymacs includes a build of DynarchLIB in it's source repository, and DynarchLIB started in 2005 (I didn't work on it full-time, though, far from it).  However, Ohloh counts DynarchLIB as a single line of code, because the code is minified, so it probably doesn't add much in the 1 person-years estimation.

      Once I put up a public code repository for DynarchLIB, it will be interesting to see how much Ohloh underestimates me. :-)

          Nov
          10
          2009
          23:00

          Ymacs — AJAX source code editor

          I just released a new project that I've been working on for about a month: Ymacs is an AJAX text editor, suitable for editing source code (currently there is support for JavaScript and XML, but more modes could be easily implemented).

          Ymacs is a DynarchLIB widget, which makes it easily embeddable into any DynarchLIB application.  This doesn't sound impressive, isn't it, but here's the real good news: I've decided to open source DynarchLIB and release it under a BSD-style license.  Some folks might believe this project is already dead, but this isn't so; it is true that there was no new release in almost two years, but the thing kept being improved and there are people using it in successful commercial applications.

          Well..  This should happen any minute, but I'm running out of time, as usual.  So it could take a few more days to push a new DL release.  In the mean time, go check Ymacs, it's pretty cool.  It has Emacs key bindings too. ;-)

          See also