Exercises on ANTLR lexical descriptions

  1. Lexical ANTLR description for strings over {a,b,c}\{a,b,c\} in which the first occurrence of bb is preceded by some aa
  2. Lexical ANTLR description for floating point numbers as 3.1416 -3e4 +1.0e-5 2. .567e+8
  3. Lexical ANTLR description for all strings of lowercase letters where each of the five vowels occur exactly once, and the vowels appear in the usual order
  4. Lexical ANTLR description for all strings of lowercase letters where the letters appear in strict lexicographic increasing order (a<b<c<<m<n<o<a<b<c<\ldots<m<n<o<\ldots)
  5. Lexical ANTLR description for financial quantities in American notation, like $**2,345.67 $12,452,183.16 $****12 $*0.124300
  6. Lexical ANTLR description for inexact constants in Scheme, like 35## 35#.## 356.3## 35. 35#. 0.#
  7. Lexical ANTLR description for the identifiers of the C programming language
  8. Lexical ANTLR description for the integer constants of the C programming language
  9. Lexical ANTLR description for the real (floating point) constants of the C programming language
  10. Lexical ANTLR description for the char constants of the C programming language
  11. Lexical ANTLR description for the string constants of the C programming language
  12. Lexical ANTLR description for the comments /*...*/ of the C programming language