Grammars

The grammars of programming languages written for Iguana can be found in this repository. The grammars are extracted from their corresponding language specification manual. For some grammars, we also provide a version of the grammar that has a natural expression grammar which is declaratively disambiguated.

The grammars are written in Rascal. The integration of Iguana into Rascal is a work in progress. To use the Iguana backend for Rascal, you need the Iguana branch of Rascal. We plan to gradually convert the grammars to the reference syntax.

If you find a bug in the grammars, or wish to see a specific grammar in this list, please open an issue on Github.

Java

The grammar is extracted from the main part of the Java Language Specification 7.

C#

The grammar is extracted from the C# Language Specification 5.

C

The grammar is extract from the C 11 Standard.

OCaml

The grammar is extracted from the OCaml language specification 4.02..

Haskell

The grammar is extracted from the Haskell 2010 language report. GHC deals with indentation-sensitive rules in the lexing phase, and the context-free part is written as if no indentation rules exist. The specification grammar of Haskell does not capture indentation-sensitive rules. In the Indentation-sensitive grammar, we use align, offside and ignore to express the indentation-rules.

XML

The grammar of XML is extracted from the Extensible Markup Language (XML) 1.1 (Second Edition). This grammar, or any other context-free grammar of XML, cannot enforce balancing of start and end tags. Our XML grammar uses data-dependency features to enforce balanced tags.

The full data-dependent grammar is under development. For the basic idea behind data-dependent parsing of XML see this example.

Python

The grammar is extracted from Python 3.4 language reference.

The work on this grammar is in progress.

Scala

The grammar is extracted from Scala 2.11 language specification.

The work on this grammar is in progress.