On 30 March 2017 at 14:25, Peter Broadbery <
p.bro...@gmail.com> wrote:
>
> I would be interested in seeing what atom can do (not really heard of
> it before now tbh).. From my experience with the intellij lexer/grammar,
> the easy part (relatively) is lexing and parsing.. the trickier part is
> recognising indented blocks. Would be interested in seeing how your
> grammar works.
>
"grammar" is the terminology used by atom but it is actually somewhat
of a misnomer. So it might be better to start at the end of the story
rather than the beginning. Atom is a text editor built on top of the
Electron platform which is essentially just a browser designed to be
used locally on the desktop instead of via the Internet.
https://electron.atom.io/ But Electron uses the same core technology
as Google's Chrome web browser - something called Chromium. Electron
is intended to be used for developing desktop applications that run
the same on Windows, Mac, and Linux so in some sense it is like the
"modern" reincarnation of gui tools like Qt with C++ replaced with
javascript, html, css, node.js and a lot of the other "modern" stuff
(re-)invented for the web. Electron and atom are part of the evolving
Google/GitHub ecosystem which includes IDE's like Nuclide
https://nuclide.io/ and a lot of other stuff:
https://electron.atom.io/apps/ .So the end of the story, or at least
the story so far is that after spending quite a lot of time working on
extending the OpenAxiom Qt-based front-end (which also in principle
works with FriCAS and Axiom), I now think that starting with Atom is a
much better option. But since I am not really well connected with the
Google "ecosystem" I only got here through the backdoor by trying to
learn more about how to highlight Spad syntax in Atom.
> The intellij-idea plugin linked above is somewhat functional with some
> syntax highlighting (it's easy to do in intellij, but one shouldn't overdo
> it). The eclipse one has foundered; I think I spent too much time trying
> to get building to work automatically.. the intellij version gives up on
> that and relies on makefiles doing the right thing.
>
The specifications for the Spad "grammar" in Atom amounts to a
relatively large set of regular expressions that define different
syntax elements.
https://www.sitepoint.com/how-to-write-a-syntax-highlighting-package-for-atom/
Atom packages in general however can be a lot more complex and a lot
more capable than this.
What I have so far is a package for Atom that installs, recognizes
Spad source code and highlights a few things. I will be glad to share
it once I get a bit more time to make it do something a bit more
interesting. But I was kind of disappointed that in Atom defining this
sort of package is not the route to being able to display and navigate
symbols in source nicely.
https://github.com/atom/symbols-view That
actually requires an external tool called ctags
http://ctags.sourceforge.net/
> The IDE approach can be very powerful when compared to a text editor;
> being able to see docs for symbols without having to switch contexts
> is great, as well as searching for functions by name. Internally, the IDE
> has a full view of the abstract syntax for any file; this can be used for
> all sorts of things - basic semantic checks, some refactorings,
> documentation, basic type extraction. Downside is that it can feel
> slower. Some of that is inevitable due to having to reparse files more
> completely, of course.
>
Doing this sort of thing is perhaps the normal scope of an Atom
package but certainly not beyond what Electron is being used for. For
example I think Electron could make a great foundation for a
replacement for Hyperdoc.
> As an aside, writing intellij extensions feels quite rewarding; one notices
> a feature in some other extension, and twisting it into a form for spad or
> aldor often turns out easier than expected.
>
Yes, that was more or less what I was hoping to find in Atom. I think
I more or less found it. But of course it is still not that easy.
Bill Page.