CS 3723
 Programming Languages 
   Colorful Tiny® Syntax  


Colorful Grammar for the Tiny® language:
  • Metasymbols [ ] enclose an optional item
  • Metasymbols { } mean "zero or more occurrences of" the item enclosed.
  • The above items are confusing because the characters [ ] { } also serve as terminal symbols in the if-then-else and the while statements.
  • Colors are used as follows:
    • red = terminal symbol,
    • green = non-terminal symbol,
    • black = metasymbol.

Colorful Grammar for Tiny® language

  M  −−−>  S { S } '$'
  S  −−−>  I  |  W  |  A  |  P  |  G
  I  −−−>  '[' E '?' S { S } ':' S { S } ']'  |  '[' E '?' S { S } ']' 
  W  −−−>  '{' E '?' S { S } '}'
  A  −−−>  lower-case '=' E ';'
  P  −−−>  '<' ( E ';'  |  upper-case ';' )
  G  −−−>  '>'  lower-case ';'
  E  −−−>  T {('+' | '-') T}
  T  −−−>  U {('*' | '/' | '%' | '@') U}
  U  −−−>  F '^' U | F
  F  −−−>  ('+' | '-') ( '(' E ')'  |  lower-case  |  digit )

Here is the same form without the single quote marks around terminal symbols.

Colorful Grammar for Tiny® language, no quote marks

  M  −−−>  S { S } $
  S  −−−>  I  |  W  |  A  |  P  |  G
  I  −−−>  [ E ? S { S } : S { S } ]  |  [ E ? S { S } ] 
  W  −−−>  { E ? S { S } }
  A  −−−>  lower-case = E ;
  P  −−−>  < ( E ;  |  upper-case ; )
  G  −−−>  >  lower-case ;
  E  −−−>  T {(+ | -) T}
  T  −−−>  U {(* | / | % | @) U}
  U  −−−>  F ^ U | F
  F  −−−>  (+ | -) ( ( E )  |  lower-case  |  digit )

Revision date: 2014-10-20. Please use ISO 8601, the International Standard Date and Time Notation.)