The Language Grammar
BNF Converter


%Process by txt2tags to generate html or latex



This document was automatically generated by the //BNF-Converter//. It was generated together with the lexer, the parser, and the abstract syntax module, which guarantees that the document matches with the implementation of the language (provided no hand-hacking has taken place).

==The lexical structure of Grammar==
===Identifiers===
Identifiers //Ident// are unquoted strings beginning with a letter,
followed by any combination of letters, digits, and the characters ``_ '``
reserved words excluded.


===Literals===
Integer literals //Integer// are nonempty sequences of digits.




===Reserved words and symbols===
The set of reserved words is the set of terminals appearing in the grammar. Those reserved words that consist of non-letter characters are called symbols, and they are treated in a different way from those that are similar to identifiers. The lexer follows rules familiar from languages like Haskell, C, and Java, including longest match and spacing conventions.

The reserved words used in Grammar are the following:
  | ``main`` |  |  |

The symbols used in Grammar are the following:
  | = | + | - | *
  | / | % | \ | ->
  | ( | ) |  |

===Comments===
Single-line comments begin with --.Multiple-line comments are  enclosed with {- and -}.

==The syntactic structure of Grammar==
Non-terminals are enclosed between < and >.
The symbols -> (production),  **|**  (union)
and **eps** (empty rule) belong to the BNF notation.
All other symbols are terminals.

  | //Program// | -> | ``main`` ``=`` //Exp//
  | //Exp3// | -> | //Ident//
  |  |  **|**  | //Integer//
  |  |  **|**  | //Exp3// ``%`` //Exp4//
  |  |  **|**  | //Exp4//
  | //Exp2// | -> | //Exp2// //Exp3//
  |  |  **|**  | //Exp2// ``*`` //Exp3//
  |  |  **|**  | //Exp2// ``/`` //Exp3//
  |  |  **|**  | //Exp3//
  | //Exp1// | -> | //Exp1// ``+`` //Exp2//
  |  |  **|**  | //Exp1// ``-`` //Exp2//
  |  |  **|**  | //Exp2//
  | //Exp// | -> | ``\`` //Ident// ``->`` //Exp//
  |  |  **|**  | //Exp1//
  | //Exp4// | -> | ``(`` //Exp// ``)``



%% File generated by the BNF Converter (bnfc 2.9.4.1).
