Parse EBNF/Tests: Difference between revisions

m
Replace <lang> tags with <syntaxhighlight>
(Created page with "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'...")
 
m (Replace <lang> tags with <syntaxhighlight>)
 
Line 2:
 
==A one-liner==
<langsyntaxhighlight lang="ebnf">"a" {
a = "a1" ( "a2" | "a3" ) { "a4" } [ "a5" ] "a6" ;
} "z"</langsyntaxhighlight>
 
Some valid inputs:
Line 18:
 
==Arithmetic expressions==
<langsyntaxhighlight lang="ebnf">{
expr = term { plus term } .
term = factor { times factor } .
Line 28:
number = digit { digit } .
digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" .
}</langsyntaxhighlight>
 
Some valid inputs:
Line 41:
 
==Some invalid EBNF==
<langsyntaxhighlight lang="ebnf">a = "1";</langsyntaxhighlight>
 
<langsyntaxhighlight lang="ebnf">{ a = "1" ;</langsyntaxhighlight>
 
<langsyntaxhighlight lang="ebnf">{ hello world = "1"; }</langsyntaxhighlight>
 
<langsyntaxhighlight lang="ebnf">{ foo = bar . }</langsyntaxhighlight>
3,028

edits