Tiny programming language

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Tiny is an extremely simple programming language used in computer science courses to teach compiler construction techniques to students.

The language itself is so basic that it only includes reading of integer numbers, addition and subtraction arithmetic operations, and displaying numerical values.

The grammar of the language follows:

<program>        -> BEGIN <stmt list> END
<stmt list>      -> <stmt list> <stmt> | <stmt>
<stmt>           -> <ident> := <expr>;
<stmt>           -> READ ( <id list> ) ;
<stmt>           -> WRITE ( <expr list> ) ;
<id list>        -> <id list>, <ident> | <ident>
<expr list>      -> <expr list>, <expr> | <expr> 
<expr>           -> <expr> <op> <factor> | <factor>
<factor>         -> ( <expr> ) | <ident> | INT
<op>             -> + | - 
<ident>          -> ID

As can be deduced from this simplistic grammar, the language is of limited practical use, gaining the most value as a teaching aid.