The Language SRL
BNF Converter


%This txt2tags file is machine-generated by the 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 SRL==
===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 SRL are the following:
  | ``do`` | ``else`` | ``empty`` | ``fi``
  | ``for`` | ``from`` | ``ftimes`` | ``if``
  | ``loop`` | ``pop`` | ``push`` | ``skip``
  | ``then`` | ``top`` | ``ttimes`` | ``until``

The symbols used in SRL are the following:
  | += | -= | ^= | [
  | ] | ++ | -- | ^
  | = | != | < | >
  | >= | <= | + | -
  | * | / | ( | )

===Comments===
Single-line comments begin with //.Multiple-line comments are  enclosed with /* and */.

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

  | //SRL// | -> | //[Blk]//
  | //[Blk]// | -> | //Blk//
  |  |  **|**  | //Blk// //[Blk]//
  | //Blk// | -> | //Step//
  |  |  **|**  | ``if`` //Exp// ``then`` //[Blk]// ``else`` //[Blk]// ``fi`` //Exp//
  |  |  **|**  | ``from`` //Exp// ``do`` //[Blk]// ``loop`` //[Blk]// ``until`` //Exp//
  |  |  **|**  | ``for`` //Exp// ``ttimes`` //[Blk]// ``do`` //[Blk]// ``loop`` //[Blk]// ``ftimes`` //[Blk]// ``until`` //Exp//
  | //Step// | -> | //Ident// ``+=`` //Exp//
  |  |  **|**  | //Ident// ``-=`` //Exp//
  |  |  **|**  | //Ident// ``^=`` //Exp//
  |  |  **|**  | //Ident// ``[`` //Exp// ``]`` ``+=`` //Exp//
  |  |  **|**  | //Ident// ``[`` //Exp// ``]`` ``-=`` //Exp//
  |  |  **|**  | //Ident// ``[`` //Exp// ``]`` ``^=`` //Exp//
  |  |  **|**  | //Ident// ``++``
  |  |  **|**  | //Ident// ``--``
  |  |  **|**  | ``push`` //Ident// //Ident//
  |  |  **|**  | ``pop`` //Ident// //Ident//
  |  |  **|**  | ``skip``
  | //Exp// | -> | ``top`` //Exp2//
  |  |  **|**  | //Exp1//
  | //Exp2// | -> | ``empty`` //Exp3//
  |  |  **|**  | //Exp3//
  | //Exp3// | -> | //Exp3// ``^`` //Exp4//
  |  |  **|**  | //Exp4//
  | //Exp4// | -> | //Exp4// ``=`` //Exp5//
  |  |  **|**  | //Exp4// ``!=`` //Exp5//
  |  |  **|**  | //Exp5//
  | //Exp5// | -> | //Exp5// ``<`` //Exp6//
  |  |  **|**  | //Exp5// ``>`` //Exp6//
  |  |  **|**  | //Exp5// ``>=`` //Exp6//
  |  |  **|**  | //Exp5// ``<=`` //Exp6//
  |  |  **|**  | //Exp6//
  | //Exp6// | -> | //Exp6// ``+`` //Exp7//
  |  |  **|**  | //Exp6// ``-`` //Exp7//
  |  |  **|**  | //Exp7//
  | //Exp7// | -> | //Exp7// ``*`` //Exp8//
  |  |  **|**  | //Exp7// ``/`` //Exp8//
  |  |  **|**  | //Exp8//
  | //Exp8// | -> | //Exp9// ``[`` //Exp// ``]``
  |  |  **|**  | //Exp9//
  | //Exp9// | -> | //Integer//
  |  |  **|**  | //Ident//
  |  |  **|**  | ``(`` //Exp// ``)``
  | //Exp1// | -> | //Exp2//


