⚠️ Warning: This is a draft ⚠️

This means it might contain formatting issues, incorrect code, conceptual problems, or other severe issues.

If you want to help to improve and eventually enable this page, please fork RosettaGit's repository and open a merge request on GitHub.

The flavor of EBNF used here is the same as that defined [http://karmin.ch/ebnf/index here], except a literal can't contain the character used for quoting, and an identifier can't contain whitespace or any of the characters = | ( ) { } [ ] . ; " '.

==A one-liner==

"a" {
    a = "a1" ( "a2" | "a3" ) { "a4" } [ "a5" ] "a6" ;
} "z"

Some valid inputs:

  • a1a3a4a4a5a6
  • a1 a2a6
  • a1 a3 a4 a6

Some invalid inputs:

  • a1 a4 a5 a6
  • a1 a2 a4 a5 a5 a6
  • a1 a2 a4 a5 a6 a7
  • your ad here

==Arithmetic expressions==

{
    expr = term { plus term } .
    term = factor { times factor } .
    factor = number | '(' expr ')' .

    plus = "+" | "-" .
    times = "*" | "/" .

    number = digit { digit } .
    digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" .
}

Some valid inputs:

  • 2
  • 2*3 + 4/23 - 7
  • (3 + 4) * 6-2+(4*(4))

Some invalid inputs:

  • -2
  • 3 +
  • (4 + 3

==Some invalid EBNF==

a = "1";
{ a = "1" ;
{ hello world = "1"; }
{ foo = bar . }