Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

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


Community support: feel free to ask any question on the SonarQube TM 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 ? This is the first question 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 :

  • The SonarQubeTM team SonarQubeteam is TDD addict and we think that existing tools don't fit well with TDD as they require some code generation and doesn't provide any simple and quick way to unit test all part of a source code analyser like a parsing rule for instance. 
  • The SonarQube TM team is KISS addict and so we think that a Java developer should be able to do anything from its favorite IDE.
  • This technology is also used to analyse some legacy languages like COBOL for instance which require some very specific lexing and preprocessing features. Implementing those features would have required to fully master the implementation of those existing tools and so we didn't benefit from a black box approach.
  • In any case, the ultimate goal of SSLR is to provide a complete compiler front-end stack, which goes well beyond the parsing. SSLR will sooner or later provide the required material to fully implement a:
    • Symbolic table (currently in beta)
    • Control flow graph
    • Data flow analysis
    • LLVM IR emitter
    • ...