Shop OBEX P1 Docs P2 Docs Learn Events
Spin Plug-in project for Eclipse — Parallax Forums

Spin Plug-in project for Eclipse

Capt. QuirkCapt. Quirk Posts: 872
edited 2011-02-19 11:51 in Propeller 1
I am looking for people that can act as an adviser to me, through this thread to explain definitions and concepts that I have no experience with as I create the Propeller (spin) plug-in.

My goal is to complete a plug-in that includes all best features of Eclipse, including a complete help section, as much debugging assistance as possible, and write a pdf explaining how to install the plug-in.

I will do all the work, but I have no experience, beyond basic programming knowledge. I do have the time, and the desire to see this through to the end.

Sincerely

Bill Mazzacane

Comments

  • AndreLAndreL Posts: 1,004
    edited 2011-02-07 11:33
    I suggest you get a good book on ecplise, read the manual on it, etc. then search around for command line compilers for SPIN (there are a few). Now, with those two things in hand you can start to develop a plug in for Eclipse. But, this is going to take some research and a lot of reading, so you understand how it works.

    First step, download eclipse and do some coding in Java to get the hang of it. And you learn a little Java in the meantime. Better yet, if you have an Android then you can do some android programming with it.

    But, unless you have VERY specific questions, this is more or less you figuring it out :)

    Andre'
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2011-02-07 20:28
    I have been using Eclipse off and on about 4 years, for C++ and Microchip's C18. I enjoy using Eclipse. Despite Eclipse's full featured, somewhat complex layout, I find it much easier to read and write code with. But with the Propeller tool (for me) it is too busy, and full of noise, and lacks the clarity of the Basic Stamp IDE. Building this plug-in is something I have wanted to do for a long time.

    Last night I didn't know what dependencies were, now I know that all the features we normally expect are dependencies in Eclipse. After I finish with ANTLR, Eclipse has other dependencies that require input from ANTLR for advanced features like code completion, smart insert mode (red squiggly line) and hovers.

    Fortunately there is a good book published for building plug-ins that I bought last night http://www.informit.com/store/product.aspx?isbn=0321553462 I have spent the last couple days doing a lot of reading from other sources, and have developed an idea of what I need to learn and execute. I found the manual (Helios version) for eclipse, and posted for reference. I have also collected the Java source code for (2) Microchip C18 plug-ins, and the very large AVR plug-in.

    I have installed the ANTLR ide, plug-ins, and configured it for Eclipse http://www.antlr.org/. There are many good video tutorials for ANTLR http://javadude.com/articles/antlr3xtut/, along with good documentation. And I started learning Java. Now I find myself curios which Paser/Lexer Ross used for Catalina?

    Propellant includes a command line interface, and an API based library. Currently my understanding of how Propellant handles errors is through a grid system of lines and # of characters. I hope to have a good understanding of Propellant soon.

    Something I am not sure about, is if Propellant will compile pasm?, and if not, how do I?

    Thanks

    Bill M.
  • AndreLAndreL Posts: 1,004
    edited 2011-02-07 23:35
    I think Ross wrote his own parser for Catalina since its not GNU based. Zog on the other hand is based on GCC, so its using GCC's stuff. As far as propellant, I haven't been keeping track of all the SPIN compilers, but there are more than one, so I am sure you will be able to find one that works for you from all these different simulators, brads spin tool, etc.

    That all said, I agree, and the Propeller 2 will in most probabilities launch as an Eclipse plug-in NOT a stand alone tool, and will support C as the native language, so you're going in the right direction :)

    Andre'
  • Heater.Heater. Posts: 21,230
    edited 2011-02-08 01:18
    Capt. Quirk,

    Sounds like you have set yourself a mammoth task. I'm not brave enough to look into Eclipse.
    ...the Propeller tool (for me) it is too busy, and full of noise, and lacks the clarity...

    I'm interested to know what you mean by that. Can you give examples of that "noise"? Admittedly I have not used the Prop Tool since the arrival BST but I recall they are similar look and feel. They are about the cleanest, simplest IDEs I have ever seen.
    Now I find myself curios which Paser/Lexer Ross used for Catalina?

    Catalina is based on the LCC compiler front end. Ross created the back end code generator for the Prop. I have no idea if LCC uses any standard Parser/Lexer internally.
    Propellant includes a command line interface....

    I do hope that if you are going to provide Propeller Spin/PASM support in Eclipse then you will be making it cross-platform. Usable on Windows, Linux, Mac possibly on non Intel architectures.

    After all that is what Eclipse is all about, that's why it's written in Java. Making it cross-platform increase the size of the user base and attracts more contributors to a project. A Windows only IDE is usless to me for example. (I know, I'm selfish)

    So, rather than use Propellant it would be preferable to use BradC's BSTC Spin compiler, or mparks HomeSpun. Both of which are cross platform (The later is written in Java) and include additional features over the Parallax Spin compiler.
  • YodaYoda Posts: 132
    edited 2011-02-08 07:25
    Heater. wrote: »
    Capt. Quirk,

    So, rather than use Propellant it would be preferable to use BradC's BSTC Spin compiler, or mparks HomeSpun. Both of which are cross platform (The later is written in Java) and include additional features over the Parallax Spin compiler.

    Heater - HomeSpun is not written in Java but .Net and requires Mono to run so I would not consider that cross platform. To really do this right in eclipse the compiler should be part of the plugin so you can do incremental code compilation and syntax checking. I agree with your other comments that should be cross platform.
  • YodaYoda Posts: 132
    edited 2011-02-08 07:47
    I have been thinking about this for quite a while. This is no easy task and I would estimate that it will take more than a year to get a full featured IDE. I am going to be starting down this path soon after I complete a couple other projects. Unfortunately I do not see any good way to distribute the work as building an IDE for eclipse is sort of a layered approach and you need one layer before you can do much work on the next. After all the skeletal work is done, then adding the bells and whistles can be distributed. I think the best part to start with (at least that is where I am starting), is to get a working compiler in Java. I would focus on the 2 books mentioned on antlr.org. If you understand those two, then writing the grammar is pretty straight forward. There are some quirks with Spin that you will have to parse. The python grammar on the same site should give you a good hint on how to do structured indents like spin. The reason I say to start here is if you look at http://www.eclipse.org/projects/project_summary.php?projectid=technology.imp you will see a nice tool set that will help in creating the plugins for the IDE and it requires a parser and ASTs. They suggest using LPG as the parser generator but supposedly ANTLR works as well and I think ANTLR is easier for the fact there is more good documentation.

    I am not sure the book you picked up is going to help you a lot as it is somewhat terse and does not really cover what you need to do to write a language ide in eclipse. Another source to look at is pydev.org which has a python ide for eclipse (and source) and looks to be a good model. I have used it extensively when I write python code.

    You should strive to be platform agnostic so that means HomeSpun is out and bstc to some extent is out as well unless you want to do work on determining which version to install which can be a real pain. Writing the grammar and ASTs for ANTLR puts you well over 75% of the compiler complete so it is worth just finishing the work. And example of the code generations can be found in the Sphinx source the mparks wrote which has a pseudo hand crafted parser/lexer and a bytecode emitter.

    I will let you know how my work progresses but I expect it to take some time as I have a lot of competing priorities.
  • Heater.Heater. Posts: 21,230
    edited 2011-02-08 08:29
    Yoda,
    Heater - HomeSpun is not written in Java but .Net....
    Oops sorry, I actually knew that, having been using it under mono on Linux, and then got my wires crossed.
    Actually I would say it is written in C# and requires mono to run it under non-Windows platforms.
    C# programs are as cross-platform as the run time, eg mono, same a Java.

    Now I know nothing about creating language specific IDEs out of Eclipse but one statement caught my eye:
    I think the best part to start with ...., is to get a working compiler in Java.

    You are implying that a Spin plugin for Eclipse requires building a new Spin compiler in Java. Surely this cannot be true. Eclipse is used all the time with existing stand alone, command line, compilers. Like GCC, or XC from XMOS or whatever for other micros. I would assume the plugin is a wrapper for such compilers.

    I guess one gets into some serious language parsing though, for the synatx highlighting and other smart features.

    Seems like a huge job anyway.
  • YodaYoda Posts: 132
    edited 2011-02-08 09:06
    No it is not required - but if you want all the bells and whistles then you will have to do that. The examples you gave don't have the deep integration. By the time you write the parsing and everything you need for syntax highlighting, auto completion, "intellisense type stuff" you have a compiler almost done - you just need to write the code emitter which for spin is not too bad and mparks already has an implementation the he wrote for Sphinx. I totally agree that it is a huge undertaking, but the benefits are if you use eclipse daily in your other work then having something you are very comfortable with is pretty powerful.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2011-02-08 13:51
    Heater,

    Noise is a description for all the distractions that are actively working to pull your attention away from what you are reading. An example of noise: you are half way through a paragraph, the text that surrounds what you are currently reading (the text you have read and are about to read) act as distracters that cause regressions. In text books there has been a trend to reduce the font size to make room for larger graphics, added more graphics and text in the margins, using glossy paper that reflects normal light. All this (and cheap fonts) contribute to making a book more difficult to read. Think of it as trying to read a book at while someone else is watching TV, or in a crowded space like Starbucks, a restaurant, or some other noisy place. Many people would just say the pages are just very busy, but for people learning disabilities (LD's) noise is an accurate description.

    Factors that reduce noise are: larger font sizes, some fonts types, good contrast values, less distracters in the margins, etc. Examples within programming that reduce noise, are all the most common features in modern IDE’s, including indenting, camel-case, and other techniques to improve readability, all reduce noise.

    I have tried turning off many of the features within the prop tool to facilitate my needs, but there are still other features that I have no control over, and I haven’t found a balance yet. So I have been thinking of straying a bit from the Prop tool by implementing a second font for comments, brackets similar to C, C++ (instead of indenting loops), and eliminating the public and private system. But I don’t know the ramifications of these changes, especially after Phil’s comments about the embedded font’s relation to the Prop tool fonts.

    My LD’s are greater than most, and it is why I started this thread, because this will be very difficult for me. I have found that tech fields attract a group of people, with many of the same quirks. So it’s my belief that this plug-in will help not just me, but it will help many others too.


    Bill M.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2011-02-11 17:23
    Just an FYI;

    I have spent the last few days reading, reading, and reading about what I am trying to do. Today I was getting reacquainted with Jack Crenshaw's Let's Build a Compiler http://compilers.iecc.com/crenshaw/ In the process I found an Eclipse plug-in for Crenshaw's Turbo Pascal examples, and I found a new open source tool for building Eclipse plug-ins called Xtext. http://marketplace.eclipse.org/content/xtext

    I figure it's going to take me months to complete this, so I wanted to share Xtext with the forum members with similar projects. The plug-ins Xtext produces will work in any Java based IDE. Here is their description so I can stop typing :)

    Xtext:

    No matter if you want to create a small textual domain-specific language (DSL) or you want to implement a full-blown general purpose programming language. With Xtext you can create your very own languages in a snap. Also if you already have an existing language but it lacks decent tool support, you can use Xtext to create a sophisticated Eclipse-based development environment providing editing experience known from modern Java IDEs in a surprisingly short amount of time. We call Xtext a language development framework.

    Xtext provides you with a set of domain-specific languages and modern APIs to describe the different aspects of your programming language. Based on that information it gives you a full implementation of that language running on the JVM. The compiler components of your language are independent of Eclipse or OSGi and can be used in any Java environment. They include such things as the parser, the type-safe abstract syntax tree (AST), the serializer and code formatter, the scoping framework and the linking, compiler checks and static analysis aka validation and last but not least a code generator or interpreter. These runtime components integrate with and are based on the Eclipse Modeling Framework (EMF), which effectively allows you to use Xtext together with other EMF frameworks like for instance the Graphical Modeling Project GMF.

    In addition to this nice runtime architecture, you will get a full blown Eclipse-IDE specifically tailored for your language. It already provides great default functionality for all aspects and again comes with DSLs and APIs that allow to configure or change the most common things very easily. And if that’s not flexible enough there is "Guice" to replace the default behaviour with your own implementations.

    Bill M.
  • Heater.Heater. Posts: 21,230
    edited 2011-02-11 23:51
    Capt.Quirk,

    A good exposition on noise.

    Seems to me this "noise" of which you speake means different things to different people.

    For example, I recently have been programming with Eclipse and the QtCreator IDE. What I would like to be able to do is:

    1) Write the code.
    2) Have it running.

    How easy could that be?

    Oh no, first you have to fight with the IDE and it's "projects" and "views" and what window does what and "where the hell does the executable end up", and where are the needed libraries, resourses etc
    etc. Not to mention getting Java to work in the first place. You have to invest a non-trival amount of effort into learning how to drive an IDE before it pays off. Many times I have found an IDE to be
    the biggest source of noise.

    For a casual programmer the Prop tool or BST is a lot less noisy. Just write and go.

    Examples within programming that reduce noise, are all the most common features in modern IDE’s, including indenting, camel-case, and other techniques to improve readability, all reduce noise.

    Interesting, indenting, camel-case and such are purely textual features determined by how you want to write the code. Not anything to do with the IDE/editor that you are writing it in.
    So I have been thinking of straying a bit from the Prop tool by implementing a second font for comments, brackets similar to C, C++ (instead of indenting loops), and eliminating the public and
    private system.

    More interesting.

    Using a different font for comments is nothing to do with the language and could be implemented in an IDE/editor along with syntax highlighting etc.

    Brackets like C/C++ is a change to the language not really an IDE/editor issue.

    Eliminating the Public/Private system. Why?. Again this is a language issue not an IDE issue.

    P.S. One thing I miss in the modern programming world is the ability to print out a one yard long code listing on 14 inch wide fan-fold line printer paper. To be able to view a large part of my creation in one go. It's like being able step back and take in a whole painting hanging on the wall rather than looking at it square centimeter by square centimeter.
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2011-02-12 01:50
    Heater. wrote: »
    Capt.Quirk,

    A good exposition on noise.

    Seems to me this "noise" of which you speak means different things to different people.

    For example, I recently have been programming with Eclipse and the QtCreator IDE. What I would like to be able to do is:

    1) Write the code.
    2) Have it running.

    How easy could that be?

    Oh no, first you have to fight with the IDE and it's "projects" and "views" and what window does what and "where the hell does the executable end up", and where are the needed libraries, resourses etc. Not to mention getting Java to work in the first place.

    You have to invest a non-trival amount of effort into learning how to drive an IDE before it pays off. Many times I have found an IDE to be the biggest source of noise.

    For a casual programmer the Prop tool or BST is a lot less noisy. Just write and go.

    Interesting, indenting, camel-case and such are purely textual features determined by how you want to write the code. Not anything to do with the IDE/editor that you are writing it in.

    More interesting.

    a) Using a different font for comments is nothing to do with the language and could be implemented in an IDE/editor along with syntax highlighting etc.

    b) Brackets like C/C++ is a change to the language not really an IDE/editor issue.

    c) Eliminating the Public/Private system. Why?. Again this is a language issue not an IDE issue.

    P.S. One thing I miss in the modern programming world is the ability to print out a one yard long code listing on 14 inch wide fan-fold line printer paper. To be able to view a large part of my creation in one go. It's like being able step back and take in a whole painting hanging on the wall rather than looking at it square centimeter by square centimeter.



    Guilty, 51 yrs old, and I tend to make everything more difficult. I would guess you are an engineer, or maybe it's just common sense to know when something is good enough. I have been wanting to do something like this for years, and there is a wealth of knowledge here that could help with specific issues

    That said, my personal need for something more clear than gray syntax on blue backgrounds with confusing tracers and faint comments is real. But, BST, does not support windows, there is no syntax highlighting, only black parallax text. I need something more. The Prop Tool or PropBasic using the SX IDE and it's fonts would be great. A plug-in for Eclipse, Net Beans, or Code Blocks is another answer. Eclipse has the best documentation. Customizing the Prop Tool for white backgrounds with no block group indicators, is ok.

    None of these are better than standard C++ fonts and syntax highlighting on a white background. But for 99.9% the people, I am sure the Prop Tool works fine. For me, the Prop Tool is Noisy, difficult to comprehend the program flow, this is my best description. Obviously I am going to put up with the noise, because this project will take a lot of time.

    Regarding a,b,c, I need something different, and I have to build a custom parser anyway, so I have the ability to make spin more C/C++ like and possibly more acceptable to others. I don't have to support things like "block group indicators", or PUB & PRI decelerations, ina, outa, dira. Despite the ramifications, the output would be the same.
  • Heater.Heater. Posts: 21,230
    edited 2011-02-12 03:17
    Capt Quirk,
    BST, does not support windows

    Do you mean "Windows" or "windows". The former it does, http://www.fnarfbargle.com/bst/Latest/,
    the later I have never felt the need for. I can always run multiple copies of my favourite editor if I ever want to see two files at the same time. With syntax highlighting thanks to Andrey Dimenyev.

    BST does indeed have syntax highlighting if you enable it in the options.
  • prof_brainoprof_braino Posts: 4,313
    edited 2011-02-12 08:02
    I have been wanting to do something like this for years

    Just do it then. Everyone will help (at least they won't be able to resist making comments). You've already got heater and yoda hooked, you certainly have access to enough brain power.

    Have you set up something with instructions on how to use/test/add to your work?
  • Capt. QuirkCapt. Quirk Posts: 872
    edited 2011-02-12 14:50
  • JonnyMacJonnyMac Posts: 9,208
    edited 2011-02-19 11:51
    I just installed Eclipse (so I can program my Android phone); I'd like to see this happen as well.
Sign In or Register to comment.