News

An Introduction to Nitra

 

Just over a year ago we announced that we’d brought on board some members of the Nemerle team, along with its lead Vlad. They have been working very hard over the past year to develop a technology named Nitra, something we spoke about briefly during JetBrains Day.

Why Nitra

Before explaining what Nitra is, let’s address the question of why it is we’ve been investing into this project.

At JetBrains we make tools for languages and frameworks. We support dozens of languages and the number of frameworks is probably close to 100, if not over. Every time a new language appears, be it a programming language, be it some new syntax for templates, we need to study it, learn it, implement the corresponding parser and then provide support for analysis and refactoring.

It’s not an easy task, and at the pace technology is moving and expectations increasing, it becomes more complicated. While we are coping, we could definitely make things easier. That’s WHY Nitra.

What is Nitra

Take a look at the following

image

Can you tell what that is (the name is a spoiler)? It’s a syntax module for Gherkin, a language used in Cucumber, a framework for defining executable specifications.

This syntax module is defined using Nitra. Add it to a project, and combined with a parser that also ships with Nitra, you can now parse Cucumber files, obtaining an Abstract Syntax Tree. This means that simply defining some grammar you get parsing capabilities.

But there’s more…

This is not just another parser generator

Nitra is not merely just another parser generator. There are a few key characteristics that make Nitra different and much more powerful.

Nitra is about extensibility

Nitra provides the ability to extend existing grammar either statically or dynamically. By not using scanning techniques it dramatically increases extensibility. This in essence allows us to not only define new languages but also extend existing ones. For instance, here’s an example of extending C# with a new .? operator.

image

Nitra is about tooling

Nitra is not only about creating and extending existing languages, but it also about tooling. Defining a syntax module will also provide features such as syntax highlighting, code folding, static analysis, refactoring, navigation and symbol lookup, effectively all the features that we provide in our existing tools and IDEs.

How does this help you, our users

Nitra leads to a much faster turnaround in providing support for new languages and frameworks. It will allow us to build support faster.

Instead of manually having to create parsers and language / tooling support for every new technology, Nitra will provide us with this with very little effort, in essence merely defining a syntax module.

This translates into a quicker turnaround with emphasis on quality, which ultimately provides you, our users, a better experience.

In addition, there is also the possibility of allowing end users to create their own DSLs without having to be experts in parsing or language implementations, and at the same time obtain capabilities such as error checking, syntax highlighting and more.

What next

As mentioned initially, Nitra has been under development for over a year. While there is a lot left to do, we have reached a point where we are comfortable enough to provide you with a status update, something we have owed you for some time.

But it’s not done yet. It’s still cooking.

For more information and updates, follow the Nitra Twitter account.

image description