An Introduction to Nitra

Hadi Hariri


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


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.


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.

Comments below can no longer be edited.

38 Responses to An Introduction to Nitra

  1. Florin Patan says:

    November 12, 2013

    NITRA sounds really nice.

    I’m currently working with the author of the GOlang plugin to update it and make it ready for IDEA 13 but we’ve seen that it would be really good if we could use a new parser / lexer for it.

    Is there any way to start using NITRA sooner? Or the better question is: when do you think NITRA will be stable enough to start using it?

    Thank you.

    • Hadi Hariri says:

      November 12, 2013

      I think right now Nitra is at a stage which would be too early for this purpose. In addition Nitra currently runs on the CLR.

      • Chris Patterson says:

        December 3, 2013

        Oh, that’s just teasing. When are the early access bits available? 🙂

  2. An Introduction to JetBrains Nitra | Enjoying The Moment says:

    November 12, 2013

    […] Hacker News Like this:Like Loading… Tags Feedly, IFTTT Categories […]

  3. Matt Davey says:

    November 12, 2013

    As a long time fan of Nemerle and one of many people who have been very eager to hear news after the Nemerle announcement last year, it’s great to see this evolution. I am still hopeful that in time, as Nitra matures, we will see some of the advancements filter back into Nemerle and its small but dedicated community.

    • Vlad says:

      November 14, 2013

      Sure! As a result, we plan to rewrite Nemerle using Nitra.

  4. Thomas says:

    November 12, 2013

    So basically this is hat XML Schema is for XML.

  5. Sasha M. says:

    November 13, 2013

    Anxious to hear how it all relates back to Nemerle. It seemed like a great language at the time you onboarded the crew and the fact that with renaming of .csproj into .nproj everything still compiled also was a major plus. But lack of tooling was crippling. Would love to revisit it one day!

    • Hadi Hariri says:

      November 13, 2013

      Nitra uses Nemerle. Nemerle is alive and kicking.

    • Vlad says:

      November 14, 2013

      One of the goals of the project – to implement IDE support for Nemerle. But this is not the only or even the main goal.

      In parallel, we are developing the current Nemerle version:

  6. says:

    November 13, 2013

    But why did you name it after a small town in Slovakia, notable for not being interesting in any way?

    • Premek says:

      November 13, 2013

      Well I don’t know why Nitra as the name but the town was the capital of the first ever state on the territory of present-day Slovakia so it is not completely uninteresting (at least to some 🙂

    • Vlad says:

      November 14, 2013

      We would like to call it Nitro, but this name gave too low relevance when searching for. Nita sounds good and has good relevance. 🙂

  7. Denis Gladkiy says:

    November 13, 2013

    How does Nitra relate to MPS? Looks like Nitra something like MPS. Why not using existing tool, but create a new one?

    • Hadi Hariri says:

      November 13, 2013

      MPS is a programming environment / workbench that is available on the JVM. Nitra is more a language ‘workbench’ but not part of an environment and targets the CLR.

      • Denis Gladkiy says:

        November 17, 2013

        What means “available on JVM”? Yes, it is written on Java, but I can generate any code using MPS. For example, we used it to generate Objective-C code from Java.

  8. Rob Hughes says:

    November 13, 2013

    I’m confused by the section about extending grammar.

    In the .? example, it seems this will allow it to be parsed by Nitra but will not actually add any functionality (and the code would not compile). Is that correct? If so, then I’m not really sure what the benefit here is.

    • Hadi Hariri says:

      November 13, 2013

      This would allow the C# language to be extended with .? operator, which in turn would mean you can use this operator in your C# code. Otherwise it wouldn’t be of much use 🙂

      • Rob Hughes says:

        November 13, 2013

        So it’s a compiler as well? Or does it use something like Roslyn to extend the ‘regular’ compiler?

        Not knowing the Nitra syntax, I’m also confused about the SafeMemberAccess line – is that also expressing what the operator does, or is it expressing how it should be parsed (e.g. lexical info) or how it should be executed?

        • Vlad says:

          November 14, 2013

          Currently Nitro provides tools to create a only parsers and a simple IDE support. At present you can to extend the parser only. But in the future, Nitra will provide toolset for building of robust compilers and IDE support. If we implements the C# compiler on Nitra, you will be able to extend it. And your constructions eventually be transformed to MSIL.

  9. Guido Smeets says:

    November 13, 2013

    When will Nitra be released? Will Nitra be released open source? Or will it be a closed source paid license? If so, what will the price be?

    Any info would be appreciated. It looks very promising.

    • Vlad says:

      November 14, 2013

      I hope the EAP will start this month. We’re working on the bug fixes.

  10. Jonas Eriksson says:

    November 14, 2013

    Looks very interesting – but I missed the basic information – where does Nitra live? In Visual Studio with ReSharper or in the Jetbrain IDEs ?

    Would it be possible to for example use Nitra to extend Html syntax with available AngularJs directives?

  11. Lorenzo says:

    November 14, 2013

    Looks very interestin and promising!
    It reminds me of M in some ways… I loved M and I was so disappointent it got “cancelled” (chopped off and put in some obscure server product).
    I am interested as well about the “language extension” part. Is it meant to be a preprocessor, and spit out C# for csc.exe, or does it emits IL and somehow weaves it with the IL generated by csc?

    • Vlad says:

      November 14, 2013

      Extensions are only supported for languages which ​​implemented on the Nitra. But no one prevents to implement the C# on Nitra. The C# parser already done.

    • mirhagk says:

      November 15, 2013

      Since the C# parser is already done, it would be pretty trivial to make it as a preprocessor that spits out slightly modified C# code that will then be compiled by csc.

      It’d be pretty cool to see a VS extension that’d look for a Nitra extension file, and implement those extensions, getting some of the best parts of Nemerle (macros/syntax extensions) into C#. I may even have to look into doing this.

  12. XML Schemas & Program Code Generation » Xml Europe Technology News says:

    November 15, 2013

    […] An Introduction to Nitra | JetBrains Company Blog […]

  13. raiph says:

    November 16, 2013

    I’m pondering Nemerle/Nitra from a high level.

    After reading this article I’m thinking of them as something like a subset of NQP/Perl 6 but more focused / less ambitious and much faster (execution speed and time to market!). Are there any ways in which this is not a reasonable description?

  14. Links for November 9th through November 16th says:

    November 17, 2013

    […] An Introduction to Nitra | JetBrains Company Blog – 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 IDE’s. […]

  15. Suminda Dharmasena says:

    December 4, 2013

    Where is the repo hosted?

    What is the level of completeness? Can it implement a language like Haskell, Agda, Coq, Idris, F#, Cal Actor Language, Scheme, Scala, Perl, Rust, BitC, Ada, C++. Why I mentioned these is that they complicated to implement and schematics are different from normal languages. Best is to have a test suite of language features and target compatibility towards comprehensiveness.

    Perhaps you can add support for JVM and Native output support also

  16. Suminda Dharmasena says:

    December 4, 2013

    Best is to have a multi paradigm test suite. Other features I can think about is something like JoCaml, Algo Skeletons, R, Fortress (through not active had many interesting features).

    Need not everything in at the 1st version but this can happen step by step.

  17. Suminda Dharmasena says:

    December 13, 2013

    To be able to cover be the best tool for the trade all the following bases needs to be covered:
    1) All bases of the lambda cube
    2) Pattern calculus – theoretical sound pattern matching
    3) Process calculus

    If all the above 3 are supported then this would be the most powerful framework.

  18. Suminda Dharmasena says:

    December 13, 2013

    Eagerly waiting to try out Nitra. Earlier I can get something more the better even if it is bleeding edge.

  19. End of Month Research Roundup – January 2014 | endjin blog says:

    March 31, 2014

    […] An Introduction to Nitra (Hadi Hariri) […]

  20. Nitra goes Open Source! | JetBrains Company Blog says:

    May 27, 2014

    […] been rather quiet about Nitra since our introductory blog post, back in November of last year. But we haven’t been sitting still. We’ve been busy building the […]

  21. Nitra es ahora de código abierto | Donde El Futuro Es El Presente. says:

    June 2, 2014

    […] Nitra en GitHub  Una introducción a Nitra  […]

  22. هادی مقیمی says:

    August 12, 2015

    سپاسگذارم بابت اطلاع رسانی 🙂