/iro4cli

An open-source rewrite of Iro, a grammar generator, supporting automatic VSCode & Atom extension generation.

Primary LanguageC#GNU General Public License v3.0GPL-3.0




An open-source, CLI based rewrite of Iro by Chris Ainsley, supporting automatic VSCode extension and Atom package generation. It's an easy to use command line tool, and will bundle up a provided Iro grammar and create various different grammar targets from it, automagically generating extensions to upload to the marketplace. Some of the available targets include:

  • Textmate
  • Atom
  • Ace
  • Pygments
  • Rouge
  • Sublime 3 (Textmate)
  • CSS

To create an Atom package and VSCode extension at the same time, you can use the following:

iro grammarFile.iro --vscode --atomext

To use the online official version of Iro, you can go to the official website. For documentation on how to create Iro grammars, check the official documentation here.

Getting Started

To get started using iro4cli, you can use one of the provided prebuilt binaries from the Releases tab on the main repository page. If one of these is not available for your chosen operating system or distribution, then you can follow the build steps below.

To build, ensure you have the .NET 6.0 SDK installed (dotnet-sdk-6.0 on apt for Ubuntu/Debian users). You will also need to install the Antlr4 v4.7.2 command line tool, and ensure it is available on PATH. Installing a newer version of the ANTLR4 command line tool or having it unavailable on PATH will result in a build error. Once these prerequisites are installed, simply run the following after cloning the repository:

dotnet build

You may need to run dotnet build twice for it to compile properly.

Usage

For all command line options available, simply run iro --help, or see the following Wiki page: https://github.com/c272/iro4cli/wiki/Command-Line-Options

For Iro grammars, an example grammar is something like the following:

name = exampleGram
file_extensions [] = exgr, exg;

styles [] {
    .example : style {
        //todo
    }
}

I highly suggest you check the official documentation for more details, however.

Progress

So far the following targets have been implemented:

  • Textmate
  • CSS
  • Ace
  • Atom
  • Pygments
  • Rouge
  • .sublime-syntax

Feature parity with Iro online here. Additional goals below.

  • VSCode Extension Generation
  • Atom Package Generation
  • Sublime Extension Generation
  • HighlightJS
  • ANTLR Input