BNF Grammar: Difference between revisions
Content added Content deleted
(GP (PARI is C)) |
m (Cancel task description and remove from categories. /bin/ed ,s/{{header|\(.*\)}}/[.[:Category:\1|\1].]/) |
||
Line 6: | Line 6: | ||
There are many extensions and variants of BNF, including Extended and Augmented Backus–Naur Forms (EBNF and ABNF). |
There are many extensions and variants of BNF, including Extended and Augmented Backus–Naur Forms (EBNF and ABNF). |
||
'''This is a deprecated task. Please move these grammars to the language's category page, or somewhere else.''' |
|||
The task here is establish a BNF grammar for as many languages as possible to facilitate language categorization and translation. |
|||
=={{header|Ada}}== |
|||
==[[:Category:Ada|Ada]]== |
|||
A BNF description of the language syntax is a part of its standard, [http://www.adaic.org/standards/1zrm/html/RM-P.html see Ada Reference Manual, Annex P]. |
A BNF description of the language syntax is a part of its standard, [http://www.adaic.org/standards/1zrm/html/RM-P.html see Ada Reference Manual, Annex P]. |
||
== |
==[[:Category:ALGOL 60|ALGOL 60]]== |
||
A BNF description of the language syntax is a part of following, |
A BNF description of the language syntax is a part of following, |
||
[http://eli-project.sourceforge.net/a60_html/a60.html#s2 ALGOL 60 ][http://www.masswerk.at/algol60/syntax.txt -Syntax of ALGOL 60] |
[http://eli-project.sourceforge.net/a60_html/a60.html#s2 ALGOL 60 ][http://www.masswerk.at/algol60/syntax.txt -Syntax of ALGOL 60] |
||
== |
==[[:Category:BASIC|BASIC]]== |
||
<div style="height:30ex;overflow:scroll"><pre> |
<div style="height:30ex;overflow:scroll"><pre> |
||
! ----------------------------------------------------------------------- |
! ----------------------------------------------------------------------- |
||
Line 179: | Line 180: | ||
| Real |
| Real |
||
</pre></div> |
</pre></div> |
||
== |
==[[:Category:BASIC Commodore PET|BASIC Commodore PET]]== |
||
<div style="height:30ex;overflow:scroll"><pre> |
<div style="height:30ex;overflow:scroll"><pre> |
||
! ----------------------------------------------------------------------- |
! ----------------------------------------------------------------------- |
||
Line 386: | Line 387: | ||
</pre></div> |
</pre></div> |
||
== |
==[[:Category:Brainf***|Brainf***]]== |
||
Code ::= Command Code | <NONE> |
Code ::= Command Code | <NONE> |
||
Command ::= "+" | "-" | "<" | ">" | "," | "." | "[" Code "]" | <ANY> |
Command ::= "+" | "-" | "<" | ">" | "," | "." | "[" Code "]" | <ANY> |
||
== |
==[[:Category:C|C]]== |
||
The Syntax follows, [http://c.comsci.us/syntax/index.html C Syntax] |
The Syntax follows, [http://c.comsci.us/syntax/index.html C Syntax] |
||
== |
==[[:Category:C++|C++]]== |
||
The Syntax follows, [http://cpp.comsci.us/syntax/statement/index.html C++ Syntax] |
The Syntax follows, [http://cpp.comsci.us/syntax/statement/index.html C++ Syntax] |
||
== |
==[[:Category:C sharp|C sharp]]== |
||
See the following, [http://csharp.comsci.us/syntax/expression/ebnf.html C-sharp syntax] |
See the following, [http://csharp.comsci.us/syntax/expression/ebnf.html C-sharp syntax] |
||
== |
==[[:Category:COBOL|COBOL]]== |
||
See link [http://www.cs.vu.nl/~x/grammars/cobol/ COBOL Grammer] |
See link [http://www.cs.vu.nl/~x/grammars/cobol/ COBOL Grammer] |
||
== |
==[[:Category:Delphi|Delphi]]== |
||
IEBNF Syntax follows [http://www.felix-colibri.com/papers/compilers/delphi_5_grammar/delphi_5_grammar.html Dephi 5 Syntax] |
IEBNF Syntax follows [http://www.felix-colibri.com/papers/compilers/delphi_5_grammar/delphi_5_grammar.html Dephi 5 Syntax] |
||
== |
==[[:Category:Fortran|Fortran]]== |
||
The BNF description follows, [http://fortran.comsci.us/syntax/statement/index.html Fortran Syntax] |
The BNF description follows, [http://fortran.comsci.us/syntax/statement/index.html Fortran Syntax] |
||
== |
==[[:Category:Haskell|Haskell]]== |
||
BNF-like description can be found at [http://haskell.org/onlinereport/index.html Haskell 98] Part I, chapters 2,3 and 4. |
BNF-like description can be found at [http://haskell.org/onlinereport/index.html Haskell 98] Part I, chapters 2,3 and 4. |
||
== |
==[[:Category:J|J]]== |
||
A draft [[J:Backus–Naur Form|BNF representation of J's syntax]] is up on the J wiki. |
A draft [[J:Backus–Naur Form|BNF representation of J's syntax]] is up on the J wiki. |
||
== |
==[[:Category:Java|Java]]== |
||
The BNF description follows, [http://www.cui.unige.ch/db-research/Enseignement/analyseinfo/JAVA/BNFindex.html BNF index of Java Language Grammar] |
The BNF description follows, [http://www.cui.unige.ch/db-research/Enseignement/analyseinfo/JAVA/BNFindex.html BNF index of Java Language Grammar] |
||
== |
==[[:Category:JavaScript|JavaScript]]== |
||
The BNF description follows, [http://javascript.comsci.us/syntax/statement/bnf.html JavaScript Syntax] |
The BNF description follows, [http://javascript.comsci.us/syntax/statement/bnf.html JavaScript Syntax] |
||
== |
==[[:Category:Lisp|Lisp]]== |
||
See link on syntax [http://cui.unige.ch/db-research/Enseignement/analyseinfo/LISP/BNFindex.html Lisp Syntax] |
See link on syntax [http://cui.unige.ch/db-research/Enseignement/analyseinfo/LISP/BNFindex.html Lisp Syntax] |
||
Outside of particularly restricted variants, no static grammar can exactly describe Lisp due to macros and reader-macros. |
Outside of particularly restricted variants, no static grammar can exactly describe Lisp due to macros and reader-macros. |
||
== |
==[[:Category:Lua|Lua]]== |
||
<div style="height:30ex;overflow:scroll"><pre> |
<div style="height:30ex;overflow:scroll"><pre> |
||
chunk ::= {stat [`;´]} [laststat [`;´]] |
chunk ::= {stat [`;´]} [laststat [`;´]] |
||
Line 487: | Line 488: | ||
Source: http://www.lua.org/manual/5.1/manual.html |
Source: http://www.lua.org/manual/5.1/manual.html |
||
== |
==[[:Category:Modula-2|Modula-2]]== |
||
See link on syntax [http://cui.unige.ch/db-research/Enseignement/analyseinfo/Modula2/BNFindex.html BNF Modula2] |
See link on syntax [http://cui.unige.ch/db-research/Enseignement/analyseinfo/Modula2/BNFindex.html BNF Modula2] |
||
== |
==[[:Category:PARI/GP|PARI/GP]]== |
||
[http://pari.math.u-bordeaux.fr/cgi-bin/viewcvs.cgi/trunk/src/language/parse.y?view=markup&revision=12950&root=pari parse.y] contains a grammar for GP. The grammar for PARI is that of [http://c.comsci.us/syntax/ C]. |
[http://pari.math.u-bordeaux.fr/cgi-bin/viewcvs.cgi/trunk/src/language/parse.y?view=markup&revision=12950&root=pari parse.y] contains a grammar for GP. The grammar for PARI is that of [http://c.comsci.us/syntax/ C]. |
||
== |
==[[:Category:Pascal|Pascal]]== |
||
The [[wp:ISO 7185|ISO 7185]] standard for Pascal uses [[wp:Extended Backus–Naur Form|Extended Backus–Naur Form]]. |
The [[wp:ISO 7185|ISO 7185]] standard for Pascal uses [[wp:Extended Backus–Naur Form|Extended Backus–Naur Form]]. |
||
Also [[wp:Van Wijngaarden grammar|Van Wijngaarden's grammar]] can be used to define |
Also [[wp:Van Wijngaarden grammar|Van Wijngaarden's grammar]] can be used to define |
||
[[Pascal]]'s grammar[http://www-users.cs.york.ac.uk/~fisher/software/yoyovwg/exs/pascal.vwg]. |
[[Pascal]]'s grammar[http://www-users.cs.york.ac.uk/~fisher/software/yoyovwg/exs/pascal.vwg]. |
||
== |
==[[:Category:Perl|Perl]]== |
||
The BNF description follows, [http://perl.comsci.us/syntax/statement/index.html Perl Syntax] |
The BNF description follows, [http://perl.comsci.us/syntax/statement/index.html Perl Syntax] |
||
== |
==[[:Category:PHP|PHP]]== |
||
The BNF description follows, [http://php.comsci.us/syntax/statement/index.html PHP Syntax] |
The BNF description follows, [http://php.comsci.us/syntax/statement/index.html PHP Syntax] |
||
== |
==[[:Category:PowerShell|PowerShell]]== |
||
An annotated version of the PowerShell grammar can be found in Bruce Payette's book ''Windows PowerShell in Action''. The appendix containing the grammar is available in [http://www.manning.com/payette/AppCexcerpt.pdf PDF form] on the publisher's site. |
An annotated version of the PowerShell grammar can be found in Bruce Payette's book ''Windows PowerShell in Action''. The appendix containing the grammar is available in [http://www.manning.com/payette/AppCexcerpt.pdf PDF form] on the publisher's site. |
||
Line 512: | Line 513: | ||
<lang powershell>for (;;) {}</lang> |
<lang powershell>for (;;) {}</lang> |
||
== |
==[[:Category:Python|Python]]== |
||
[http://docs.python.org/reference/grammar.html Python grammar]. |
[http://docs.python.org/reference/grammar.html Python grammar]. |
||
== |
==[[:Category:Ruby|Ruby]]== |
||
Syntax follows [http://web.njit.edu/all_topics/Prog_Lang_Docs/html/ruby/yacc.html Ruby Syntax] |
Syntax follows [http://web.njit.edu/all_topics/Prog_Lang_Docs/html/ruby/yacc.html Ruby Syntax] |
||
== |
==[[:Category:Scala|Scala]]== |
||
The [http://www.scala-lang.org/docu/files/ScalaReference.pdf Scala Specification] contains an Extended BNF under Scala Syntax Summary, Chapter A. |
The [http://www.scala-lang.org/docu/files/ScalaReference.pdf Scala Specification] contains an Extended BNF under Scala Syntax Summary, Chapter A. |
||
== |
==[[:Category:Scheme|Scheme]]== |
||
The formal syntax for Scheme is written in an extended BNF in [http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-7.html#node_chap_4 chapter 4] of the [http://www.r6rs.org/final/html/r6rs/r6rs.html Revised^6 Report on the Algorithmic Language Scheme]. |
The formal syntax for Scheme is written in an extended BNF in [http://www.r6rs.org/final/html/r6rs/r6rs-Z-H-7.html#node_chap_4 chapter 4] of the [http://www.r6rs.org/final/html/r6rs/r6rs.html Revised^6 Report on the Algorithmic Language Scheme]. |
||
== |
==[[:Category:SQL|SQL]]== |
||
Syntax for SQL follows, [http://savage.net.au/SQL/sql-2003-2.bnf.html BNF Sytax for SQL Database Language] |
Syntax for SQL follows, [http://savage.net.au/SQL/sql-2003-2.bnf.html BNF Sytax for SQL Database Language] |
||
== |
==[[:Category:Smalltalk|Smalltalk]]== |
||
Smalltalk Syntax follows, [http://github.com/aquasync/ruby-ometa/blob/60deea23abe7eb07d200233dde4213d74041b81f/smalltalk.syntax Smalltalk Syntax] |
Smalltalk Syntax follows, [http://github.com/aquasync/ruby-ometa/blob/60deea23abe7eb07d200233dde4213d74041b81f/smalltalk.syntax Smalltalk Syntax] |
||
== |
==[[:Category:Tcl|Tcl]]== |
||
Though Tcl is not typically described using BNF, an approximation of the base language grammar can be written in a [[:Category:Tcl#Grammar|BNF-like grammar]]. Note however that the grammar properly omits things present in other languages (notably keywords) because it lacks them entirely; the analogs of them are merely parts of the standard language library. |
Though Tcl is not typically described using BNF, an approximation of the base language grammar can be written in a [[:Category:Tcl#Grammar|BNF-like grammar]]. Note however that the grammar properly omits things present in other languages (notably keywords) because it lacks them entirely; the analogs of them are merely parts of the standard language library. |
||
== |
==[[:Category:VBScript|VBScript]]== |
||
<div style="height:30ex;overflow:scroll"><pre> |
<div style="height:30ex;overflow:scroll"><pre> |
||
!=============================== |
!=============================== |
||
Line 1,274: | Line 1,275: | ||
</pre></div> |
</pre></div> |
||
== |
==[[:Category:Visual Basic .NET|Visual Basic .NET]]== |
||
The following link (Appedix B) has a simple BNF Syntax [http://laser.physics.sunysb.edu/~amol/papers/mollypaper.pdf VB Syntax] |
The following link (Appedix B) has a simple BNF Syntax [http://laser.physics.sunysb.edu/~amol/papers/mollypaper.pdf VB Syntax] |
||
<div style="height:30ex;overflow:scroll"><pre> |
<div style="height:30ex;overflow:scroll"><pre> |
||
Line 1,945: | Line 1,946: | ||
<Identifier> ::= ID | QualifiedID !Any type of identifier |
<Identifier> ::= ID | QualifiedID !Any type of identifier |
||
</pre></div> |
</pre></div> |
||
{{omit from|Scratch|programming is done with graphical objects, not code}} |