Syntax Diagrams

The syntax of a high level language is the set of rules that has to be obeyed when a program is written.

These rules must be unambiguous...every instruction must have a single meaning. The computer must not have to make any decisions about what actions it is to perform.

The syntax of a high level language can be defined in two ways :

  • Syntax diagrams
  • Backus Naur Form (BNF)

 

Syntax Diagrams.

A diagrammatic way of expressing the syntax of a language. For example, the PASCAL definition of an identifier is :

Any path from left to right spells out a valid identifier.

eg FRED, F3, R2D2 are all valid identifiers but 3D and 77 are not.