s-expressionists / Eclector

A portable Common Lisp reader that is highly customizable, can recover from errors and can return concrete syntax trees
https://s-expressionists.github.io/Eclector/
BSD 2-Clause "Simplified" License
109 stars 9 forks source link

Query: is the source code for the demonstrations from your presentation available? #76

Open rpgoldman opened 1 year ago

rpgoldman commented 1 year ago

Sorry to drop an issue for a simple question. I'm interested in using Eclector, but thought it would be easier to learn if the source code for one or more of the demonstrations was available. Are the examples anywhere?

Thanks!

/cc @scymtym

scymtym commented 1 year ago

I'm not sure which examples you are referring to. The slides for the presentation are available online.

Could you link to the specific slides containing the examples you are interested in? You can copy the URL of the slide currently being displayed like this: https://s-expressionists.github.io/Eclector/presentation-slides/slides.html#/slide-slide%3Aextensibility%3Asandboxing.

rpgoldman commented 1 year ago

@scymtym Thank you very much for the quick response! I am interested in re-animating the redshank emacs lisp library, which did some refactorings for common lisp code. Unfortunately, it mostly does this by operating on the strings, which is very difficult. But if I want to operate on the code in CL instead of Emacs-lisp, I can't be destroying the ancillary information like comments. Eclector seems perfect for this.

A couple of things seem of interest to me:

  1. The lisp-style command line application/console linter (the McCLIM one would be good, but it is much more complicated because it dynamically maintains the read, and has UI code): https://s-expressionists.github.io/Eclector/presentation-slides/slides.html#/slide-slide%3Ademos%3Alisp.style
  2. The syntax highlighting demo https://s-expressionists.github.io/Eclector/presentation-slides/slides.html#/slide-slide%3Ademos%3Ahighlighting-1

As an aside, protocol.lisp-server also sounds very interesting. I should read over that, since it might make things easier to use lsp-mode in emacs. But that is a matter for some more research.

scymtym commented 1 year ago

I see.

The lisp-style command line application/console linter

This one uses a lot more than just Eclector. From the top of my head:

So the linter demo would be difficult to reproduce with just the stable, published part of the software stack.

The syntax highlighting demo

I could make this code available in a branch in the Eclector repository. However, I would say that parse results produced by Eclector are not at the most useful level for highlighting. Ideally, information obtained by parsing the s-expression representation would be used, like in these demonstrations: https://techfak.de/~jmoringe/semantic-highlighting-2.png, https://techfak.de/~jmoringe/semantic-highlighting.ogv, https://techfak.de/~jmoringe/semantic-highlighting-2.ogv.

rpgoldman commented 1 year ago

Thank you very much! Anything you could provide would be helpful. You might try either putting these examples in a branch, adding an examples subdirectory, or even adding an eclector-examples repo to the s-expressionists group.

I'd welcome anything that would not be too much trouble to you.

I think for a refactoring server to SLIME or SLY, it would be OK to have read intern things, since presumably this code is going to be read anyway.

Local refactoring could also manage, at least initially, by parsing only a one-s-expression subset of the file. In this case redshank already has code to find the relevant s-expression, it's just that now it functions without talking to the host lisp.

Anyway, it wouldn't be absolutely necessary to me to have a working linter or highlighter example -- I'd be happy just to have the code that shows how that example interacted with Eclector. The Eclector documentation is great, but it's a little overwhelming, especially in this age of TL;DR!

Thank you again for your attention and patience.

scymtym commented 1 year ago

Anything you could provide would be helpful. You might try either putting these examples in a branch, adding an examples subdirectory, or even adding an eclector-examples repo to the s-expressionists group.

I have a few unpushed examples in the examples directory that I plan to push after the current batch of changes.

That said, I checked the branch that I prepared for the online lisp meeting presentation and it is actually still current in terms of the syntax highlighting example. You can find that example in examples/highlight/ in the online-lisp-meeting branch. The file examples/highlight/interface.lisp has the high-level interface. examples/highlight/render/ansi-text.lisp and examples/highlight/render/html.lisp are probably self-explanatory.

Thank you again for your attention and patience.

Sure