Noeud « Next »: Semantics, Noeud « Previous »: Lexical Specifications, Noeud « Up »: Tiger Language Reference Manual
We use Extended BNF, with [ and ] for zero or once, ( and ) for grouping, and { and } for any number of repetition including zero.
program ::= exp exp ::= # Literals. nil | integer | string # Array and record creations. | type-id [ exp ] of exp | type-id {[ id = exp { , id = exp } ] } # Variables, field, elements of an array. | lvalue # Function call. | id ( [ exp { , exp }] ) # Operations | - exp | exp op exp | ( exps ) # Assignment | lvalue := exp # Control structures | if exp then exp [else exp] | while exp do exp | for id := exp to exp do exp | break | let decs in exps end lvalue ::= id | lvalue . id | lvalue [ exp ] exps ::= [ exp { ; exp } ] decs ::= { dec } dec ::= # Type declaration type id = ty # Variable declaration | var id [ : type-id ] := exp # Function declaration | function id ( tyfields ) [ : type-id ] = exp # Types ty ::= type-id | { tyfields } | array of type-id tyfields ::= [ id : type-id { , id : type-id } ] type-id ::= id op ::= + | - | * | / | = | <> | > | < | >= | <= | & | |