summaryrefslogtreecommitdiff
path: root/ebnf.md
blob: d0fd11c9c3d8967d05993c06a744ca8579cbd05f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# EBNF language description

    
    decimal digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ;
    decimal literal = decimal digit, {decimal digit}, [".", {decimal digit}];

    octal digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7";
    octal literal = "0o", octal digit, {octal digit}, [".", {octal digit}];

    hex digit = decimal digit | "A" | "B" | "C" | "D" | "E" | "F" | "a" | "b" | "c" | "d" | "e" | "f";
    hex literal = "0x", hex digit, {hex digit}, [".", {hex digit}];

    binary digit = "0" | "1";
    binary literal = "0b", {binary digit}, [".", {binary digit}];

    numeric literal = binary literal | hex literal | octal literal | decimal literal;
    
    character = ? any unicode character except "\" ?;
    escape sequence = "\", ("u", hex digit, {hex digit} | ? any ascii character except "u" ?);

    character literal = "'" (character | escape sequence) "'";
    
    singlet literal = character literal | numeric literal

    string literal = "\"", {character | escape sequence}, "\""

    literal = singlet literal | string literal