Ivory Language Grammar

Description

This page lists all the productions in the Ivory language grammar, separated by basic function. The grammar is completely context-free, given certain precedence rules and associativity. Note: this particular grammar is designed more for reading, and may not be 100% usable with yacc. The parser description in the bootstrap compiler, is slightly terser, but is 100% acceptable to yacc.

Associativity

The following terminals are right-associative:

  • if
  • else
  • (
  • )
  • +=
  • -=
  • *=
  • /=
  • %=
  • >>=
  • <<
  • |=
  • &=
  • ^=

The following terminals are left-associative, and in order of precedence:

  • --, ++, [, ]
  • ?, :
  • ||
  • &&
  • |
  • ^
  • &
  • !=
  • ==
  • <=
  • >=
  • <
  • >
  • <<
  • >>
  • -
  • +
  • /
  • %
  • *

Productions

The program production acts as the starting symbol for an ivory program.

Productions are divided as follows:

Program Structure

Declarations

Types

Statements

Expressions