conferences | speakers | series

Langkit: source code analyzers for the masses

home

Langkit: source code analyzers for the masses
FOSDEM 2018

Langkit is a framework that aims to make it easy to create a source code analyzer for a language, by specifying its syntax and high level semantics in a domain specific language, and compiling this specification to a library that clients can use to implement any tool that needs syntactic and information about source code for that language.

Modern programming environments are heavily multi-languages. Where programmers had to use one or two languages at most, most developpers today have to juggle with an order of magnitude more languages. But people are still using pretty basic text editors and tools, with very little source awareness. Libraries for automated source code analysis are still pretty scarce. Solutions for analysis of incorrect code are still often ad-hoc and proprietary, and every language implementor has to re-invent the wheel several times.

Langkit is a framework that aims to change that to some extent, making it easy to specify your language's syntax and high level semantics in a domain specific language, and compiling this specification to a library that clients can use to implement any tool that needs syntactic and information about source code for that language.

Generated engines support out of the box includes: Ada, C, and Python APIs for the engine, support for embedding into long lived applications, high performance parsing. Also, since Langkit knows a lot about your language, it can be used to auto-generate, or ease the generation of:

  • Source code unparsers (pretty-printers)
  • Source code highlighters
  • Auto completion servers
  • Language servers (implementing for example the Microsoft Language Server Protocol)
  • Static analyzers

This talk will go over the Langkit architecture, what is doable with Langkit, and the design choices and compromises that have been made.

Speakers: Raphaƫl Amiard Pierre-Marie De Rodat