Supporting new languages
The steps to cover a new programming language are:
- Write the grammar. This is the hardest part.
- Write a parser (a parser simply parses an input based on your grammar to yield a parse tree).
- Test your grammar, to ensure it is able to parse real-life language files.
- 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.
- Write a scanner Sensor, in a SonarQube plugin, to launch the visitors.
- raw measures
- code duplications
- syntax highlighting
- symbol table
- coverage information (lines/branches to cover, line/branch hits)
In fulfilling these steps, the SonarSource Language Recognizer (SSLR) can be an important resource.
© 2008-2023, SonarSource S.A, Switzerland. Except where otherwise noted, content in this space is licensed under a Creative Commons Attribution-NonCommercial 3.0 United States License. SONARQUBE is a trademark of SonarSource SA. All other trademarks and copyrights are the property of their respective owners.