README.md in ebnf-0.3.1 vs README.md in ebnf-0.3.2

- old
+ new

@@ -22,11 +22,11 @@ puts ebnf.to_sxp puts ebnf.to_ttl puts ebnf.to_ebnf -Transform EBNF to BNF (generates `alt` or `seq` from `plus`, `star` or `opt`) +Transform EBNF to BNF (generates sub-productions using `alt` or `seq` from `plus`, `star` or `opt`) ebnf.make_bnf Generate [First/Follow][] rules for BNF grammars @@ -79,78 +79,25 @@ progress("Parsing completed with errors:\n\t#{e.message}") raise RDF::ReaderError, e.message if validate? end ## EBNF Grammar -The [EBNF][] variant used here is based on [W3C][] [EBNF][] as defined in the +The [EBNF][] variant used here is based on [W3C](http://w3.org/) [EBNF][] (see {file:etc/ebnf.ebnf EBNF grammar}) as defined in the [XML 1.0 recommendation](http://www.w3.org/TR/REC-xml/), with minor extensions. - /* An EBNF grammar for EBNF */ - [1] ebnf ::= (declaration | rule)* +## Example parser +For an example parser built using this gem, see {file:examples/ebnf-parser/README EBNF Parser example}. This example creates a parser for the [EBNF][] grammar which generates the same Abstract Syntax Tree as the built-in parser in the gem. - [2] declaration ::= '@terminals' | '@pass' - - [3] rule ::= lhs '::=' expression - - [4] lhs ::= '[' (SYMBOL | '.')+ ']' SYMBOL - - [5] expression ::= alt - - [6] alt ::= seq ('|' seq)* - - [7] seq ::= diff+ - - [8] diff ::= postfix ('-' postfix)* - - [9] postfix ::= primary ( [?*+] )? - - [10] primary ::= HEX - | RANGE - | ENUM - | O_RANGE - | O_ENUM - | STRING1 - | STRING2 - | '(' expression ')' - - @terminals - - [11] SYMBOL ::= ([a-z] | [A-Z] | [0-9] | "_")+ - - [12] HEX ::= '#x' ([0-9] | [a-f] | [A-F])+ - - [13] RANGE ::= '[' CHAR '-' CHAR ']' - - [14] ENUM ::= '[' CHAR+ ']' - - [15] O_RANGE ::= '[^' CHAR '-' CHAR ']' - - [16] OENUM ::= '[^' CHAR+ ']' - - [17] STRING1 ::= '"' (CHAR - '"')* '"' - - [18] STRING2 ::= "'" (CHAR - "'")* "'" - - [19] CHAR ::= HEX - | ('\\' [\\trn'"]) - | [^\t\r\n'"] - - @pass ::= ( - [#x20\t\r\n] - | - )+ - ## Acknowledgements Much of this work, particularly the generic parser, is inspired by work originally done by Tim Berners-Lee's Python [predictive parser](http://www.w3.org/2000/10/swap/grammar/predictiveParser.py). The EBNF parser was inspired by Dan Connolly's [EBNF to Turtle processor](http://www.w3.org/2000/10/swap/grammar/ebnf2turtle.py), [EBNF to BNF Notation-3 rules](http://www.w3.org/2000/10/swap/grammar/ebnf2bnf.n3), and [First Follow Notation-3 rules](http://www.w3.org/2000/10/swap/grammar/first_follow.n3). - ## Documentation Full documentation available on [Rubydoc.info][EBNF doc]. ## Future Work * Detect FIRST/FOLLOW and left-recursion conflicts. @@ -175,15 +122,18 @@ ## License This is free and unencumbered public domain software. For more information, see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file. +A copy of the [Turtle EBNF][] and derived parser files are included in the repository, which are not covered under the UNLICENSE. These files are covered via the [W3C Document License](http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231). + [Ruby]: http://ruby-lang.org/ [YARD]: http://yardoc.org/ [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html [EBNF]: http://www.w3.org/TR/REC-xml/#sec-notation [EBNF doc]: http://rubydoc.info/github/gkellogg/ebnf/master/frames [First/Follow]: http://en.wikipedia.org/wiki/LL_parser#Constructing_an_LL.281.29_parsing_table [LL(1)]: http://www.csd.uwo.ca/~moreno//CS447/Lectures/Syntax.html/node14.html [LL(1) Parser]: http://en.wikipedia.org/wiki/LL_parser -[Tokenizer]: http://en.wikipedia.org/wiki/Lexical_analysis#Tokenizer \ No newline at end of file +[Tokenizer]: http://en.wikipedia.org/wiki/Lexical_analysis#Tokenizer +[Turtle EBNF]: http://dvcs.w3.org/hg/rdf/file/default/rdf-turtle/turtle.bnf