Anonymous user
BNF Grammar: Difference between revisions
m
→Pascal: move to pacsal page
m (→Pascal: move to pacsal page) |
|||
(34 intermediate revisions by 17 users not shown) | |||
Line 1:
{{
In computer science, Backus–Naur Form (BNF) is a metasyntax used to express context-free grammars: that is, a formal way to describe formal languages. John Backus and Peter Naur developed a context free grammar to define the syntax of a programming language by using two sets of rules: i.e., lexical rules and syntactic rules.
Line 6:
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.'''
==
<div style="height:30ex;overflow:scroll"><pre>
! -----------------------------------------------------------------------
Line 179 ⟶ 174:
| Real
</pre></div>
==
<div style="height:30ex;overflow:scroll"><pre>
! -----------------------------------------------------------------------
Line 386 ⟶ 381:
</pre></div>
==
Code ::= Command Code | <NONE>
Command ::= "+" | "-" | "<" | ">" | "," | "." | "[" Code "]" | <ANY>
==[[: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].
==[[: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.
This grammar does not accurately represent the PowerShell language, though, as for example the <code>for</code> loop mandates semicolons in the grammar but in practice does not require them when arguments are omitted. The infinite loop may be represented by
<lang powershell>for () {}</lang>
but the grammar would require
<lang powershell>for (;;) {}</lang>
==
<div style="height:30ex;overflow:scroll"><pre>
!===============================
Line 4,896 ⟶ 1,140:
| 'Empty'
</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]
<div style="height:30ex;overflow:scroll"><pre>
! -----------------------------------------------------------------------
Line 5,566 ⟶ 1,812:
<Identifier> ::= ID | QualifiedID !Any type of identifier
</pre></div>
|