Computing - Syntax Diagrams

2021-01-22
1 min read

See also:

2021-01-22

What is a syntax diagram??

A graphical equivalent of BNF.

PHOTO SYNTAX DIAGRAM TERMINAL SYMBOL What does this represent in a syntax diagram??

A terminal symbol.

PHOTO SYNTAX DIAGRAM NON TERMINAL SYMBOL What does this represent in a syntax diagram??

A non-terminal symbol.

PHOTO SYNTAX DIAGRAM REPEATED 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??

PHOTO SYNTAX DIAGRAM NON ZERO DIGIT

Can you picture what an integer would look like in a syntax diagram, made from a “non-zero-digit” and a “digit” category??

PHOTO SYNTAX DIAGRAM INTEGER

PHOTO SYNTAX DIAGRAM DIGIT 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.

PHOTO SYNTAX DIAGRAM DIGIT How would you write this in BNF using a “non-zero-digit” category??
<digit> ::= <non-zero-digit>|0
PHOTO SYNTAX DIAGRAM INTEGER 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??


Metadata
date: 2021-01-22 11:29
tags:
- '@?computing'
- '@?regular-languages'
- '@?public'
title: Computing - Syntax Diagrams
Attachments