Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Backus–Naur form
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Structure== BNF specifications outline how symbols are combined to form syntactically valid sequences. Each BNF consists of three core components: a set of [[Nonterminal symbol|non-terminal symbols]], a set of [[Terminal symbol|terminal symbols]], and a series of derivation rules.<ref name="janikow2">{{cite web |last1=Janikow |first1=Cezary Z. |title=What is BNF? |url=http://www.cs.umsl.edu/~janikow/cs4280/bnf.pdf}}</ref> Non-terminal symbols represent categories or variables that can be replaced, while terminal symbols are the fixed, literal elements (such as keywords or punctuation) that appear in the final sequence. Derivation rules provide the instructions for replacing non-terminal symbols with specific combinations of symbols. A derivation rule is written in the format:<syntaxhighlight lang="bnf"> <symbol> ::= __expression__ </syntaxhighlight> where: * <code><[[symbol]]></code><ref name="class">{{cite web |last=Naur |first=Peter |date=1961 |title=A COURSE OF ALGOL 60 PROGRAMMING with special reference to the DASK ALGOL system |url=http://archive.computerhistory.org/resources/text/algol/ACM_Algol_bulletin/1064048/frontmatter.pdf |access-date=26 March 2015 |publisher=Regnecentralen |publication-place=Copenhagen}}</ref> is a non-terminal symbol, enclosed in angle brackets (<>), identifying the category to be replaced * {{Code|1=::=}} is a metasymbol meaning "is replaced by," * [[expression (mathematics)|<code>__expression__</code>]] is the replacement, consisting of one or more sequences of symbols—either terminal symbols (e.g., literal text like "Sr." or ",") or non-terminal symbols (e.g., {{Code|1=<last-name>|2=bnf}})—with options separated by a [[vertical bar]] (|) to indicate alternatives. For example, in the rule {{Code|1=<opt-suffix-part> ::= "Sr." {{!}} "Jr." {{!}} ""|2=bnf}}, the entire line is the derivation rule, "Sr.", "Jr.", and "" (an empty string) are terminal symbols, and {{Code|1=<opt-suffix-part>|2=bnf}} is a non-terminal symbol. Generating a valid sequence involves starting with a designated start symbol and iteratively applying the derivation rules.<ref name="janikow">{{cite web |last1=Janikow |first1=Cezary Z. |title=What is BNF? |url=http://www.cs.umsl.edu/~janikow/cs4280/bnf.pdf}}</ref> This process can extend sequences incrementally. To allow flexibility, some BNF definitions include an optional "delete" symbol (represented as an empty alternative, e.g., {{Code|1=<item> ::= <thing> {{!}}|2=bnf}} ), enabling the removal of certain elements while maintaining syntactic validity.<ref name="janikow" />
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Backus–Naur form
(section)
Add topic