Eclipse plugin for Cat, bugfix

0 views
Skip to first unread message

Adrian Savage

unread,
Aug 22, 2007, 10:45:01 PM8/22/07
to Cat Language
Hello to the Cat language group!

I am creating a plugin for Eclipse.
Once I downloaded the right package, it was easier than I thought.
I want to ask the group whether you think I should write my first full-
blown PEG parser, or just a simple scanner?
I want the plugin to go beyond syntax highlighting and onto
refactoring etc.

Also, I have a bug fix.

Before the fix:
evens evens == (returns true, as if it checked all even numbers)
odds ones == (returns true)
evens ones == (gives a stack exception after a while)
After:
evens evens == (waits forever while it checks them)
odds ones == (returns false)
evens ones == (returns false)

The fix is for Cat 0.17.0, I dedicate it to the public domain and its
here:
http://nothingontelly.com/goodgrief/CatFunctionalList.cs

The function PairwiseForEach has a missing ! and when this is fixed,
it runs out of stack space when comparing possibly-infinite equal
lists.
When tail recursion optimisation is added, it would give up on unequal
sized possibly-infinite lists.
This leads to some changes which perhaps don't have the beauty of the
original code.
While making this change I discovered that you can create a function
in C# without giving it a name, and have it access a local variable
(like Java's inner classes but more elegant). This is done in an
instance of the PairAccessor delegate.

Regards,

Adrian Savage

Christopher Diggins

unread,
Aug 22, 2007, 11:12:14 PM8/22/07
to catla...@googlegroups.com
On 8/22/07, Adrian Savage <nothing...@googlemail.com> wrote:
>
> Hello to the Cat language group!

Welcome Adrian!

> I am creating a plugin for Eclipse.

Yay!

> Once I downloaded the right package, it was easier than I thought.
> I want to ask the group whether you think I should write my first full-
> blown PEG parser, or just a simple scanner?

I'd suggest starting with a simple scanner. It'll probably take much
less time, and allow you to get on to more interesting tasks. However,
I believe there is already an open-source PEG library in Java

> I want the plugin to go beyond syntax highlighting and onto
> refactoring etc.
>
> Also, I have a bug fix.
>
> Before the fix:
> evens evens == (returns true, as if it checked all even numbers)
> odds ones == (returns true)
> evens ones == (gives a stack exception after a while)
> After:
> evens evens == (waits forever while it checks them)
> odds ones == (returns false)
> evens ones == (returns false)
>
> The fix is for Cat 0.17.0, I dedicate it to the public domain and its
> here:
> http://nothingontelly.com/goodgrief/CatFunctionalList.cs

Thank you.

> The function PairwiseForEach has a missing ! and when this is fixed,
> it runs out of stack space when comparing possibly-infinite equal
> lists.
> When tail recursion optimisation is added, it would give up on unequal
> sized possibly-infinite lists.
> This leads to some changes which perhaps don't have the beauty of the
> original code.
>
> While making this change I discovered that you can create a function
> in C# without giving it a name, and have it access a local variable
> (like Java's inner classes but more elegant). This is done in an
> instance of the PairAccessor delegate.
>
> Regards,
>
> Adrian Savage

Thank you very much for your contributions and bug reports.

- Christopher

Adrian Savage

unread,
Aug 30, 2007, 4:33:33 PM8/30/07
to Cat Language
A simple version of the Cat editor plugin is now available.
To use it, download this file and put it into the plugins subfolder of
Eclipse.

http://nothingontelly.com/CatPlugin/com.nothingontelly.plugins.Cat_1.0.0.jar

Comments are welcome; they will help me to improve it.

Regards,

Adrian Savage

Christopher Diggins

unread,
Aug 31, 2007, 1:21:52 AM8/31/07
to catla...@googlegroups.com
Thank you very much for this contribution Adrian! I will be leaving
tommorrow morning and will take a close look at it when I get back on
Monday.

- Christopher

Adrian Savage

unread,
Aug 31, 2007, 2:36:13 PM8/31/07
to catla...@googlegroups.com
Thanks. I released a new version because 1.0.0 didn't work well with Eclipse 3.2.2. The Cat plugin now has a web page. Version 1.0.1 includes source code (.jar files are .zip files with a different extension.) It is available from:

http://nothingontelly.com/CatPlugin

Christopher Diggins

unread,
Sep 1, 2007, 11:23:25 AM9/1/07
to catla...@googlegroups.com
Hi Adrian,

I just tried using the Cat plugin, and when I constructed a ".cat"
file from scratch, I could see the neat Cat icon on the project
explorer pane (nice touch!). However, no syntax coloring was present
(and it red squiggle highlighted various words?). The next problem
occured when I tried to open a file:

Error opening the editor.
Bad version number in .class file

Any ideas what I could do to resolve the problem? I have no idea where
to start, and I don't know which ".class" file is being referred to.

- Christopher

Adrian Savage

unread,
Sep 1, 2007, 4:35:34 PM9/1/07
to catla...@googlegroups.com
Which version of Eclipse did you use?
Which operating system?

 

Christopher Diggins

unread,
Sep 1, 2007, 7:47:03 PM9/1/07
to catla...@googlegroups.com
Eclipse 3.3, Windows XP. I have downloaded and unzipped the version
1.0.1 of the plugin into my plugins folder.

- Christopher

Adrian Savage

unread,
Sep 2, 2007, 9:49:07 AM9/2/07
to catla...@googlegroups.com
For some reason, Windows Explorer seems to rename the .jar file to .zip.
(I didn't notice this the first time I tested it because I used Download Manager instead.)
Instead of unzipping it, try renaming it back to .jar.
Just drop the .jar file into the plugins folder as it is.
 
Does that work?

 

Christopher Diggins

unread,
Sep 2, 2007, 11:46:20 PM9/2/07
to catla...@googlegroups.com
Unfortunately no. I am downloading Eclipse 3.2 to see if that works.

Adrian Savage

unread,
Sep 3, 2007, 3:11:20 AM9/3/07
to catla...@googlegroups.com
It's strange. Perhaps you need to delete the files created when the .jar was unzipped.
"eclipse -clean" resets the plugin settings.
I have now tried it on Windows Vista and Eclipse 3.3. It worked fine but I had to fight IE and change the filename back to .jar. I would expect it to work on Eclipse 3.2 onward.
Which Java runtime are you using? Does a fresh install of 3.3 work?
If it still doesn't work then I don't know what else to suggest because I am an Eclipse newbie. Sorry!

Christopher Diggins

unread,
Sep 3, 2007, 10:29:41 AM9/3/07
to catla...@googlegroups.com
Tried with 3.2.

Got the following error: "Unable to create this part due to an
internal error. Reason for the failure: The editor class could not be
instantiated. This usually indicates that the editor's class name was
mistyped in plugin.xml."

My runtime is Java 2 Runtime Environment, SE v 1.4.2_03.

I doubt reinstalling 3.3 will work (I've already downloaded and
installed three different versions of eclipse)

Cheers,
Christopher

Adrian Savage

unread,
Sep 3, 2007, 4:19:35 PM9/3/07
to catla...@googlegroups.com
Thanks, I reproduced the error!
I spent some time trying each version of Java and of Eclipse.
Cat Plugin 1.0.1 required Java 1.6.0 (a.k.a. Java 6).
Cat Plugin 1.0.2 requires only Java 1.4 which most people have (Eclipse recommend Java 1.5 although 1.4 seems to work).
The syntax highlighting works well on Eclipse 3.3 but not on 3.2.x

Regards,
Adrian

Christopher Diggins

unread,
Sep 4, 2007, 11:34:20 PM9/4/07
to catla...@googlegroups.com
Hi Adrian,

I got it working! I am now able to create a new Cat file and type some
things, and see some syntax aware coloring and formatting.

Some comments:
- When I tride to open a couple of existing Cat file (e.g.
everything.cat or standard.cat) I get a single message "ERROR" in the
editor view.
- comments are only formatted when outside of definitions
- numbers and string are not distingusished from identifiers (this
would be nice to have).
- Ideally I'd like meta-comment labels to be italicizied, or somehow
distinguished from the meta-comment blocks.

This is exciting stuff, I can't wait for more advanced features! Let
us know when you are ready to hear ideas for fun to have features. I
am sure you have a bunch of ideas already.

Cheers,
Christopher


On 9/3/07, Adrian Savage <nothing...@googlemail.com> wrote:

Adrian Savage

unread,
Oct 7, 2007, 9:23:25 PM10/7/07
to Cat Language
Hi Christopher,

I could not reproduce the first problem because the editor+plugin seem
to open existing .cat files alright on my computer.
Other problems are due to the highlighting not being very clever - it
does not handle one 'partition' (syntax element) nested in another.
It's a restriction of the default Eclipse partitioner.
A fix for that may have to wait for a version with a more complete
parser.

Regards,
Adrian

Adrian Savage

unread,
Oct 15, 2007, 6:52:33 PM10/15/07
to catla...@googlegroups.com
Version 1.1.0 of the Cat plugin released!
http://nothingontelly.com/CatPlugin/index.htm

Highlights strings and numbers. Identifiers in definitions are highlighted differently from those outside. Comments are highlighted in definitions, type definitions, and metadata too.

(This version came soon after I discovered that syntax elements correspond to tokens in the Eclipse highlighting editor, and there can be many tokens in one partition.)

Comments about the plugin are welcome at nothing...@googlemail.com

Christopher Diggins

unread,
Oct 16, 2007, 1:36:00 AM10/16/07
to catla...@googlegroups.com
Hi Adrian,
 
I am getting a message: "Error" instead of the file contents when I try to open any Cat file from the current distribution (Eclipse 3.3 SDK, Latest Java runtime, Windows XP, etc.)
Can you find a way to catch exceptions, and provide more informative feedback when things go wrong in the next release? I realize this is challenging to debug because of all the different possible combinations of JRE / Eclipse / OS, etc, but if you can find a way to give more informative feedback to the user it would be a great help.
 
Thanks for your continued hard work on this project, it will be appreciated by myself and many others, I promise!
 
- Christopher Diggins
 

Adrian Savage

unread,
Nov 2, 2007, 7:51:59 PM11/2/07
to catla...@googlegroups.com
Hi all,

Is anyone else having problems with the Cat plugin for Eclipse?
By the way, the latest version 1.1.2 gives an outline view and moves the editor / outline to the selected section.

and Christopher,

It sounds like the plugin is not launching properly for you. There may be an exception thrown from Eclipse itself.
Running the plugin in debug mode might throw some light on this strange error, because that gives a full stack trace if an uncaught exception is thrown.
The source code is included in the plugin itself.

Regards, Adrian

Christopher Diggins

unread,
Nov 8, 2007, 12:00:44 PM11/8/07
to catla...@googlegroups.com
Hi Adrian,

I am unfortunately completely swamped for at least the next couple of
weeks, but afterwards I will try to sit down with the plug-in, and
find out exactly what the problem is. I will conduct a detailed code
review as well.

- Christopher

Adrian Savage

unread,
Nov 22, 2007, 6:42:45 PM11/22/07
to catla...@googlegroups.com
Hi,
At last I have replicated the problem with the Eclipse plugin!
It is caused by opening files in Eclipse 3.3 using the filesystem
rather than an Eclipse project, that is, using the "File|Open" menu or
using drag and drop.
Using the Eclipse project system works fine.
I will look into how other Eclipse plugins manage this problem.
Plugin 1.1.3 now displays an explanatory error message if the document
can't be created.
Regards, Adrian

Christopher Diggins

unread,
Nov 22, 2007, 9:05:16 PM11/22/07
to catla...@googlegroups.com
That is great news, thanks Adrian. Sorry I hadn't followed through on
my previous promise.

- Christopher

Reply all
Reply to author
Forward
0 new messages