How do I launch the SSLR toolkit?

Hi everyone,

I’m currently trying to develop my own plugin for a new language and I’m trying to use SSLR in order to feed metrics to the SonarQube API. I have writter a Parser, a Lexer, and a very basic Grammar for my language.

I’m looking to execute the toolkit on a piece of code to see the AST that SSLR will build for it, but I don’t seem to understand how to launch the toolkit. Can someone help me a little ? :smiley:

Have a nice day.


What’s your problem?
Do you have a problem writing a class like FlexToolkit or running it?
If you don’t manage to run it, how do you run it? Which message do you get?

1 Like

Hi Pierre-Yves, sorry for not making my first message accurate enough :slight_smile:

I adapted the classes from here so that they fit my language :

I’m using VSCode to run the main from the, but it says that there is a classpath problem. I’m aware this probably wasn’t the best option to begin with, but I didn’t know how else I could go with this …

Thanks for your help, and sorry if I’m missing basic stuff.

Do you manage to compile your class?

Yes, it compiles without any errors.

Here’s what VSCode says :


When I press “Add to source path”, it returns :


If I ask it to skip, it simply gives the classpath error predicted by VSCode.

Sorry, I’m not familiar with Java development in VSCode.
If you manage to compile your class, you should also be able to run it.
If you have a pom.xml file, it means that you’re using Maven.
Use Maven to build your project. You can then execute the class from your command line interface.

1 Like

Hi Pierre-Yves,

Thanks again for your help. In order to make sure my modifications didn’t alter the plugin, I redownloaded the original sslr-master folder. I compiled it using “mvn clean install” on the parent pom.

That’s where I seem to be stuck. How do I run the toolkit from there ?

Thanks a lot for your patience.

Edit : I tried to launch the toolkit from sonar-flex using java-jar but upon analyzing a flex file I got this error :

Indeed, if you build a jar where the main class is the toolkit, then you can run java -jar.

What you got on sonar-flex toolkit is the expected behavior. You got a parsing error because sonar-flex doesn’t parse XML files, it parses ActionScript files and you can find examples inside sonar-flex repository.

1 Like

Thanks a lot for your answers, I understand how it all works a lot better now !

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.