BNF of the Modula-2 Programming Language

Each element of this page is an anchor to a description of a syntax rule of the Modula 2 language. Each rule is illustrated by a graphical syntactic diagram. The rule names and non-terminal names are extracted from "Programming in Modula-2" Niklaus Wirth, Springer-Verlag eds., Berlin, 1983. The rules are listed below in their order of appearance in the above manual.
[What is BNF?]
[other languages BNF]
[credits & contributors]

Some interesting starting points to explore the language:
Compilation (root of the syntax)
Declarations
Expressions
[index on key words]
[index on special characters]

  1. identifier_letter
  2. upper_case_letter
  3. lower_case_letter
  4. ident
  5. qualident
  6. number
  7. integer
  8. real
  9. scale_factor
  10. hexdigit
  11. digit
  12. octaldigit
  13. string
  14. comment
  15. constant_declaration
  16. const_expression
  17. simple_const_expr
  18. const_term
  19. const_factor
  20. set
  21. element
  22. type_declaration
  23. type
  24. simple_type
  25. enumeration
  26. subrange_type
  27. array_type
  28. record_type
  29. field_list
  30. variant
  31. case_labels
  32. set_type
  33. pointer_type
  34. procedure_type
  35. variable_declaration
  36. designator
  37. expression
  38. simple_expression
  39. term
  40. factor
  41. statement
  42. assignment
  43. procedure_call
  44. statement_sequence
  45. if_statement
  46. case_statement
  47. case
  48. while_statement
  49. repeat_statement
  50. for_statement
  51. loop_statement
  52. with_statement
  53. procedure_declaration
  54. procedure_heading
  55. block
  56. declaration
  57. formal_parameters
  58. fp_section
  59. formal_type
  60. module_declaration
  61. priority
  62. export
  63. import
  64. definition_module
  65. definition
  66. program_module
  67. implementation_module
  68. compilation_unit

Credits & Contributors
This document and the syntactic diagrams were generated by "HyperGOS", a syntactic tools generator, developped at the University of Geneva by Jacques Guyot, Thibault Estier and Pascal Crausaz. HyperGOS is derived from GOS, a generic tool "a la Lex & Yacc", initialy developped by Jacques Guyot (some 15 years ago...) and extended since in many directions by many, many contributors, here at University of Geneva. The automatic diagram layout program was originally written by NGuyen Lai in 1981.

© 1994-1995 Th. Estier Geneva / estier@cui.unige.ch
Jacques Guyot | guyot@cui.unige.ch