5. Syntax Diagram
Another popular method way of defining grammatical rules of a language or data type is to use a graphical method called 'Syntax Diagrams'.
Syntax diagrams are made up of a few specific symbols that together define any grammatical rule.
Symbol: A circle with some text inside
This is an item that is not defined in any more detail. There are no lower level syntax diagrams defining this any further. This is called a 'terminal symbol'
This is because the item described is self-evident. For example if the number '1' was inside the circle, then there is no need to define what '1' means (unless you are a mathematician).
Symbol: A rectangle with some text inside
This is an item that is defined in some more greater detail in another syntax diagram. For example the text might be 'postal address' and because it is a rectangle rather than a circle, you should expect to see a syntax diagram describing the internal structure of 'postal-address'.
An arrow in a syntax diagram indicates the direction in which you are allowed to read the overall diagram. For example
This shows you should read it from left to right.
An arrow that loops back to an earlier point indicates a repetition of the items in-between. For example
This indicates that there is at least one address, but there may be any number of additional addresses as well because the arrow is allowing you to read the item again and again.
Challenge see if you can find out one extra fact on this topic that we haven't already told you
Click on this link: syntax diagrams
Copyright © www.teach-ict.com