BNF Study Notes

Source: Internet
Author: User

The Backus paradigm (Backus-naur Form) is a formal notation introduced by Backus and Naur to represent the syntax of a programming language. Specification

The characters in the quotation marks represent these themselves, and the quote represents the quotation marks
The character representing the syntax of the quotation.
<> the content in angle brackets indicates a required option
[] The contents of the square brackets indicate the optional
The contents of {} braces represent items that can be repeated 0 to countless times
| A vertical bar indicates either left or right selection
: = The meaning of the colon equals when defined as the advanced

BNF often uses recursive forms, such as:

<pp>:=<tt>|<tt><pp>

Represents an example of a PP consisting of one or more TT 201,700-degree star rematch 1001 for bomb number of BNF expression

<bomb number>: = <bomb term> | <bomb number> <bomb term>
<bomb term>: = <number> | ' (' <number> ') ' # ' (' <non-zero-digit> ') '
<number>: = <digit> | <digit> <number& gt;
<digit>: = ' 0 ' | ' 1 ' | ' 2 ' | ' 3 ' | ' 4 ' | ' 5 ' | ' 6 ' | ' 7 ' | ' 8 ' | ' 9 '
<non-zero-digit>: = ' 1 ' | ' 2 ' | ' 3 ' | ' 4 ' | ' 5 ' | ' 6 ' | ' 7 ' | ' 8 ' | ' 9 '

The

digit represents a single digit (0 to 9), and Non-zero-digit indicates that a non-0 digit (1 to 9)
number represents a value greater than or equal to one digit, and can have a leading 0
bomb term that represents a # or (number) # ( Non-zero-number)
Bomb number represents one or more bomb term 201,700-degree star rematch 1002 for the BNF representation of bomb expression

<bomb expression>: = <bomb term> | <bomb expression> <bomb term>
<bomb term>: = <bomb statement> | ' (' <bomb statement> ') ' # ' (' <number> ') '
<bomb statement>: = <bomb element> | <bomb St atement> <bomb element>
<bomb element>: = <digit> | '+' | '-' | ' * '
<normal expression>: = <norm term> | <normal expression> ' + ' <norm term> | <normal expr Ession> '-' <norm term>
<norm term>: = <number> | <norm term> ' * ' <number>
<n Umber>: = <digit> | <non-zero-digit> <number>
<digit>: = ' 0 ' | <non-zero-digit>
<non-zero-digit>: = ' 1 ' | ' 2 ' | ' 3 ' | ' 4 ' | ' 5 ' | ' 6 ' | ' 7 ' | ' 8 ' | ' 9 '

Non-zero-digit represents a non-0 number (1 to 9), digit represents a single digit (0 to 9)
Number means one digit and cannot have a leading 0 (can be 0)
Norm term indicates that one or more number is connected by *
Normal expression indicates that one or more norm term is connected by +,-

Bomb element represents a single number or an operator (+-*)
Bomb statement indicates that one or more bomb element is connected
Bomb term denotes a bomb statement or (Bomb statement) # (number)
Bomb expression denotes one or more bomb term connected sentiment

BNF is a very normative form, which can standardize language.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.