SSLR stands for SonarSource Language Recognizer. It is a lightweight Java library which provides everything required to analyse any piece of source code. Using SSLR, you can quickly create a lexer, a parser, and some AST visitors to implement quality rules or compute measures. This library is already used in SonarQube by the Java, JavaScript, COBOL, C#, Python, PL/SQL, C/C++, Flex, etc. plugins.

Source Code

Download: from maven central


Community support: feel free to ask any question on the SonarQube developer mailing-list

License: LGPLv3


Why yet another tool for language recognition? Why not reusing open source and well-know libraries like ANTLR or JavaCC? These are the first questions asked by any developer discovering SSLR. Of course this option was seriously studied and had big advantages but we decided to start from scratch for the following reasons:


Here are the main features of SSLR :


SSLR evolves pretty quickly and we hope to remove these limitations sooner or later :

SSLR in Action

If you want to start working with SSLR, you must be familiar with the following standard concepts : Lexical Analysis, Parsing Expression Grammar and AST(Abstract Syntax Tree). From there you can take a look to the source code of the JavaScript (lexer/parser, rules), Flex (lexer/parser, rules) or Python (lexer/parser, rules) plugins to see how those languages are analysed with help of SSLR. 

SSLR also comes with a MiniC language which has been created to easily and simply test all SSLR features. This MiniC language can be a good starting point for a beginner to understand how to implement/define the different mandatory layers to analyse a language: