10.0 | Extension Guide | Developing a plugin | Supporting new languages

Was this page helpful?

Start Free

Supporting new languages

The steps to cover a new programming language are:

  1. Write the grammar. This is the hardest part.
  2. Write a parser (a parser simply parses an input based on your grammar to yield a parse tree).
  3. Test your grammar, to ensure it is able to parse real-life language files.
  4. Write a few parse tree visitors. Some visitors will compute metrics such as executable lines, while others will enforce coding rules. A dozen or so visitors are sufficient for an initial release.
  5. Write a scanner Sensor, in a SonarQube plugin, to launch the visitors.
  6. Compute
    1. issues
    2. raw measures
    3. code duplications
    4. syntax highlighting
    5. symbol table
    6. coverage information (lines/branches to cover, line/branch hits)

In fulfilling these steps, the SonarSource Language Recognizer (SSLR) can be an important resource.

© 2008-2024 SonarSource SA. All rights reserved. SONAR, SONARSOURCE, SONARLINT, SONARQUBE, SONARCLOUD, and CLEAN AS YOU CODE are trademarks of SonarSource SA.

Creative Commons License