3 Replies Latest reply on Nov 25, 2016 4:00 AM by adinn

    Eclipse implementation

    jeffmaury

      I am starting an Eclipse Tooling implementation for Byteman that will provide:

      • an editor (with syntax highlighting, error markers, code assist)
      • possibility to add Byteman agent to common Eclipse launch (Java, OSGI framework, remote)

       

      So I need to parse Byteman rules files as well as adding the Byteman JARs to the launch configurations.

      Do you think the Byteman runtime should be configurable or can I use the latest Byteman version that I will embed into my plugins ?

      I saw that a 4.0 version is on track will it be compatible with the 3.0 ones ?

       

      Thanks

        • 1. Re: Eclipse implementation
          adinn

          Hi Jeff,

           

          Thanks for your interest in providing Eclipse IDE support. That would be a great addition to the project.

           

          You might want to look at JIRA issue BYTEMAN-29 which includes a link to a partially complete implementation  done by a masters student.

           

          Regarding release configuration:

           

          Byteman has been remarkably good at retaining backwards-compatiibility so you probably don't need to worry about allowing users to specify a Byteman version so long as oyur plugin uses a recent release. If you use the latest 3.x release then it should work correctly with almost any Byteman rules developed for earlier releases. The only major incompatibility in Byteman's history was introduced when Byteman shifted from relying on JDK5 to JDK6 at release 1.1.0 and the only problem there was that from that point onwards Byteman could not be used on JDK5. All subsequent releases can be used on any of JDK[678].

           

          The 4.0.0 early (prototype) releases have been provided to ensure that Byteman can continue to be used to test early releases of JDK9+. You can run with earlier (3.x.x) releases on JDK9 but may find that some attempts to access 1) nonpublic members of classes or 2) any members of unexported classes will fail. In the long run the 4.0.0 releases will probably be the best ones for you to build on. They can still be used on JDK[678], are fully backwards compatible with the 3.x.x releases and avento had any problems reported (so far :-). However, if you don't want to enjoy life at the bleeding edge you could start by using the latest mainstream release (3.0.6) and switch to 4.0.0 when it is officially released.

           

          Regarding parsing:

           

          Byteman uses a hybrid approach to rule parsing. The initial line-oriented clauses in a rule (CLASS, METHOD/INTERFACE, AT (location clause), HELPER etc) are parsed using a simple regexp scanner. The free-format clauses in the rule body (BIND IF DO) are parsed using a Javacup grammar and JFlex tokeniser (I confess I am an old school yacc/lex and bison/flex LALR grammar type, despite having written a fair few recursive descent parsers in Prolog). You could perhaps reuse the parser/tokeniser classes from byteman.jar but they have not been built for that purpose (if you wish to repurpose them I would be happy to provide advice and help). My masters student decided to implement a recursive descent (achh, spit!) parser using Eclipse's XText support. Follow the link in the issue and you should find an almost completely up to date grammar that should work for Eclipse or Antlr.

          • 2. Re: Eclipse implementation
            jeffmaury

            Andrew,

             

            thanks for the answer.

            Regarding the runtime, I started embedding Byteman 3.0.6. So let's see.

            Regarding the editor and parsing, as the goal is to land into JBossTools and as a long time XText user, I know it's heavy and Max was not very enthusiastic about it, I think we can follow a path without using it as the Byteman syntax is not that complex

            • 3. Re: Eclipse implementation
              adinn

              3.0.6 should be fine. I recall that Max was not exactly 'inspired' by my student's use of XText :-) No doubt you can do something more efficient using, say, Antlr. If you need any help developing a suitable set of grammar rules or with any other details of how Byteman works then please ask here.

               

              regards,

               

              Andrew Dinn