Syntax highlighting spad, input and aldor files

19 views
Skip to first unread message

Grégory Vanuxem

unread,
Jul 25, 2023, 4:14:59 PM7/25/23
to fricas...@googlegroups.com
Hello,

I'm working on a syntax file for languages in object and I wonder if
you know where I can find syntax hints to highlight files when edited
(here VS Code or, with pure MIT licensing, Code - OSS [1]). In fact, I
am completely rewriting an extension where the file defining how
highlight FriCAS user files was in the past based on Bill Page's work
for the Atom IDE. I know Peter Broadbery worked in this direction and
more, but for IntelliJ [2]. I have to look at his plugin better. But
in case you have data on which keywords, operators etc. are supported,
I would be very grateful if you have links or any other things on
this.

Regards,
__
Greg

[1] https://github.com/microsoft/vscode
[2] https://github.com/pbroadbery/aldor-idea-plugin

Grégory Vanuxem

unread,
Jul 25, 2023, 7:56:47 PM7/25/23
to fricas...@googlegroups.com
II guess I have to start with src/boot/typrops.boot.
But if you know some other sources, for example for Aldor or
differences between the Spad language and the interpreter language,
that would. great.

Peter Broadbery

unread,
Jul 26, 2023, 5:10:55 AM7/26/23
to fricas-devel
There is a lexer and parser in the intellij plugin code. I think these could be used as a starting point..  lexing (ie.deciding on what is an id, number or keyword) is relatively easy, mostly lex regexps with some special cases.

The hard part is accounting for indented blocks in the grammar.. there is code for that in the plugin (Linearise.java), based on the aldor and Fricas code bases. Be warned that it isn't pretty, with are a lot of edge cases. To be expected given the problem domain, I guess.

At the grammar level the spad and aldor languages are pretty similar and can be dealt with together, but there's enough differences to force some special cases. The plugin covers most of this, but I'd have to remind myself of the details. It covers about 98% if both code bases.

Happy to help with any questions you have.

Peter

--
You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAHnU2dZEGn-K3P38ZYScv-6kBSEFA_HyEnfbSb0pnwviKRyCYQ%40mail.gmail.com.

Grégory Vanuxem

unread,
Jul 29, 2023, 5:10:32 AM7/29/23
to fricas...@googlegroups.com
Hello Peter,

Many thanks for your return. I am in your code right now and I have to
say, I omitted a little the indented blocks work. I have seen from
Microsoft or vs-python, some code relative to this but this is a good
reminder, I am putting it in my virtual todo list. But not in the near
future for now.

Le mer. 26 juil. 2023 à 11:10, Peter Broadbery <p.bro...@gmail.com> a écrit :
>
> There is a lexer and parser in the intellij plugin code. I think these could be used as a starting point.. lexing (ie.deciding on what is an id, number or keyword) is relatively easy, mostly lex regexps with some special cases.
>
> The hard part is accounting for indented blocks in the grammar.. there is code for that in the plugin (Linearise.java), based on the aldor and Fricas code bases. Be warned that it isn't pretty, with are a lot of edge cases. To be expected given the problem domain, I guess.
>
> At the grammar level the spad and aldor languages are pretty similar and can be dealt with together,

Yes, the more I think about that, the more I think I will re-do a
single syntax file for the three languages. I will see.

> but there's enough differences to force some special cases. The plugin covers most of this, but I'd have to remind myself of the details. It covers about 98% if both code bases.
Bravo!

Regards,
__
G. Vanuxem
>
> Happy to help with any questions you have.
>
> Peter
>
> On Wed, 26 Jul 2023, 00:56 Grégory Vanuxem, <g.va...@gmail.com> wrote:
>>
>> II guess I have to start with src/boot/typrops.boot.
>> But if you know some other sources, for example for Aldor or
>> differences between the Spad language and the interpreter language,
>> that would. great.
>>
>> --
>> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAHnU2dZEGn-K3P38ZYScv-6kBSEFA_HyEnfbSb0pnwviKRyCYQ%40mail.gmail.com.
>
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/CAK%3DmBN8xSz5a6%2BZ7FHt2c1F81o2W1xRyAOekLBOrCdbVuvgjdw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages