Interlisp / medley

The main repo for the Medley Interlisp project. Wiki, Issues are here. Other repositories include maiko (the VM implementation) and Interlisp.github.io (web site sources)
https://Interlisp.org
MIT License
375 stars 19 forks source link

Want port to WebASM to run in a browser #40

Open masinter opened 4 years ago

masinter commented 4 years ago

we've been discussing via email; issue is to make sure it's captured https://groups.google.com/g/lispcore/c/vSPTKqrKQ3I/m/zQFrWXt_AgAJ

masinter commented 3 years ago

Perhaps it is time to look at this again. https://computerhistory.org/blog/introducing-the-smalltalk-zoo-48-years-of-smalltalk-history-at-chm/ might be a benchmark -- how to produce an equivalent demo?

dwymark commented 2 years ago

Just a thought-- maybe xpra would be helpful. It provides a remote xserver and an HTML5 client streaming an X11 session on that xserver. This would be more amenable to an "interlisp as a service" than a "compile to WASM and run in the browser" approach though.

(Also: nice to meet you all! I'm Daniel. I was mentored by a Common Lisp enthusiast in my first role out of college doing linguistic / NLP research. I just learned about Interlisp today when I stumbled on your repo. I have been reading some of the materials in the wiki and playing with the Medley REPL a bit this evening.)

nbriggs commented 2 years ago

Hi Daniel -- great minds think alike: someone has already mentioned to us that they've got a working Interlisp setup with Xpra running in the cloud. Not publicly available, but definitely proof that it can be done with considerably less effort than trying to fit it into WASM+browser.

dwymark commented 2 years ago

That's great, glad to hear it.

Another random thought I had: I see that Interlisp Medley historically was available for DOS. Can we still build it for DOS? There is now very capable DOS emulation in the browser; check out the "DOS games" section on the Internet Archive for some examples.

Perhaps they are using this library which comes up immediately when searching for "dosbox in the browser": https://js-dos.com

nbriggs commented 2 years ago

The Medley 2.0 (we're on 3.5.1) emulator was built on/for MS-DOS, and is available from the repo at https://github.com/Interlisp/dos -- it should run sysouts that were built for any Medley 2.0 system and I know people have run it on DOSBOX. I haven't tried building the current emulator C code for DOS, in fact we've been considering stripping the DOS-specific code out and concentrating only on Unix/Linux style, possibly with some concessions to current Windows systems (but not personally having any Windows systems that hasn't exactly been high on my list...)

masinter commented 2 years ago

@fghalasz got http://notecards.online to work using https://github.com/Interlisp/notecards . We need some way of giving people a way to access files and save their work if we're going to offer usage though.

orcmid commented 2 years ago

@nbriggs It struck me that with cross-platform availability of .NET (MAUI), there is another way to get onto iOS and Android. There is also .NET in the browser (BLAZOR), where it runs in the client.

That seems like a stretch, but if you ever considered JVM for hosting InterLisp, .NET is probably interesting too.

.NET 2021 is happening on-line as part of launch for .NET 6, Tuesday to Thursday, 11/9-11/11. There are some mumbles about WebASM on the agenda too. https://www.dotnetconf.net/agenda/

PS: @masinter I would think DOS is not a great model. I would think x64 and mainly STD:C11 (POSIX library), plus maybe OpenGL, would be a better fit. Completely out the top of my head though (although I've been playing with raylib, which fits that picture and that I think will provide me the equivalent of the MS-DOS CUA stuff in a graphical terminal).

PPS: Access to local storage in some sort of controlled (i.e., secured) manner is a feature too. This can be in a persistent sandbox, at least, in the way MSIX does installs on a local machine. Workable for game saves, not certain about Interlisp SYSOUT, if I understand that :).

dwymark commented 2 years ago

After I mentioned DOS emulation in the browser, it occurred to me that someone has probably done the same for Linux.

I found a promising x86 emulation library called "v86": https://github.com/copy/v86

I am looking a bit into what it might take to run interlisp on a linux image in the browser using this library. I have some experience with Tiny Core Linux, which they listed as compatible, so I've been seeing if I can get something working using Tiny Core as a base. The demo they have on their website includes an ability to download files from the VM, so maybe there is potential in this approach.

EDIT: I hit the submit comment button too quickly. Edited to finish my thought.

fghalasz commented 2 years ago

Re: Xpra and Interlisp in the Cloud

I did use Xpra (running in a docker container alongside Interlisp on an AWS EC2 instance) for the initial implementation of notecards.online. Worked fine as long as I used an external webserver to feed the HTML5 pages (as opposed to having the Xpra server feed the HTML5 pages).

In finishing up the implementation, however, I switched off of Xpra and used TightVNC plus noVNC instead. I made this change because I wanted to build my docker containers on top of the "official" Medley docker containers and the official docker containers already use TightVNC. Turns out the TightVNC/noVNC combo works slightly better than Xpra - fewer screen glitches - even if it is a bit more complicated of a setup (due to the fact that TightVNC has no websocket support).

@dwymark - you are welcome to try Notecards online - just don't publicize it widely as yet since I'm not confident it will scale gracefully. Just go to http://notecards.online. Sign up for an account. Then from the main page do "Start Notecards". You should get a full Interlisp environment with Notecards loaded in your browser window.

fghalasz commented 2 years ago

@fghalasz got http://notecards.online to work using https://github.com/Interlisp/notecards . We need some way of giving people a way to access files and save their work if we're going to offer usage though.

For notecards.online, I save and give the user download access to Notecards related files, specifically 1) a directory of Notefiles, 2) the Notecards source directory and 3) lisp.virtualmem. So if a user, for example, edits the Notecards Lisp source during a session, the edited files can subsequently be downloaded from the web using any SFTP client. (Uploading files to the web also works.)

The use of SFTP to access the files from notecards.online does not lead to the greatest User Experience but it works, its universal and its robust.

I did not include the Interlisp source code in the files preserved for users across sessions and made downloadable . But that could very easily be added - just a one line change to the web portal. Its more a matter of the economics of storing duplicate copies of the Medley source for every user. I didn't think that would make economic sense for the Notecards user base.

Details: For notecards.online, I simply create and save 3 docker volumes for each user (notefiles, notecards source and lisp.virtualmem). These docker volumes are mounted when I start the docker container for a user session. Writes to files within these mounted volumes are preserved when the user session ends (and the container is killed and removed). Writes to any other files are simply thrown away when the container is killed (or maybe only when the container is removed, which in normal operation for notecards.online is tied to its being killed).

dwymark commented 2 years ago

Sounds like you've put a lot of work into notecards.online and it has great potential :)

I'll put a pin in the v86 idea for now and look for a more useful way to contribute.

fghalasz commented 2 years ago

@dwymark: I certainly did not mean to stomp on your idea of running Medley within the browser itself. Overall, I think that would be a better solution than using the browser as a portal to Medley running in the cloud (which is what notecards.online does).

But Medley-running-in-browser is a MUCH bigger task than the 50-ish hours that I put into notecards.online so far. And Medley-running-in-the-cloud was a good enough solution for Notecards. So that's what I did.

dwymark commented 2 years ago

@fghalasz : Got it, that makes sense. I started playing with building an image for running Interlisp in the browser via v86 and felt like I was making some progress with it, so I'll mess with it a bit more and see where it leads me :)

masinter commented 1 year ago

@daniel-dominic we've come a long way. I think I can close this issue

masinter commented 10 months ago

I'm not sure why I closed this -- I was looking for the more recent discussion. There's certainly more to do to meet this objective.

masinter commented 10 months ago

@dwymark @orcmid we're not doing a very good job cultivating open source contributors who might help with our objectives. There's a proof of concept Medley in the browser now, but it still needs work to make it work as well as the VNC solution. But getting older versions of Medley online will need the "remote" capabilities. The serious problems the subject "Want port to WebASM to run in a browser" encounters is:

dwymark commented 9 months ago

Sorry @masinter, I don't have time now to take on as much as I thought I'd be able to when I first engaged with this project.

masinter commented 9 months ago

I meant to leave this as a pointer: https://groups.google.com/g/lispcore/c/tiD2PUzBLCo/m/OtNFaHZPBwAJ with a pointer to https://applied-langua.ge/~hayley/il/ldesdl.html and https://interlisp.org/pub-pdfs/wasm/ldesdl.html

which gives you an image with all of the 'full' and some other 'lispusers' things with source code loaded.

@dwymark there are still some things to be worked out (A 'url' based file system? Keyboard handling) but there's now a Proof of Concept.