Computing - Syntax Diagrams
See also:
[[Computing - Backus-Naur Form]]A
2021-01-22
What is a syntax diagram?
A graphical equivalent of BNF.
What does this represent in a syntax diagram?
A terminal symbol.
What does this represent in a syntax diagram?
A non-terminal symbol.
What does this represent in a syntax diagram?
A non-terminal symbol that can be used more than once.
Can you picture what a non-zero digit would look like in a syntax diagram?
Can you picture what an integer would look like in a syntax diagram, made from a “non-zero-digit” and a “digit” category?
What does the fork on the left hand side of this syntax diagram mean?
A digit can either be a non-zero digit or a zero.
How would you write this in BNF using a “non-zero-digit” category?
<digit> ::= <non-zero-digit>|0
How would you write this in BNF using a “non-zero-digit” and a “digit” category?
<integer> ::= <non-zero-digit>|<integer><digit>
When drawing a syntax diagram, should you write recursive rules or iterative ones?
Iterative rules.
Question
Are you allowed to use recursive definitions in syntax diagrams??