On Tue, Oct 20, 2009 at 9:32 AM, Slava Pestov <[email protected]> wrote:
> Hi Jon,
>
> I made some changes of my own to Chris's docs before merging them,
> namely changing $unchecked-example to $example, so that help lint will
> check them, and actually making the examples work :-) Can you redo
> your patch on top of my changes?
>
> Slava
>
> On Mon, Oct 19, 2009 at 4:07 PM, Jon Harper <[email protected]> wrote:
>> Hey,
>> I just looked through the EBNF docs, and although the content is
>> really great, it doesn't look great in the ui browser. Here's a patch
>> that fixes a typo, replaces $subsection by klazuka's new $subsections
>> and fixes examples
>> Also, the new $subsections doesn't appear in the "Block elements" help
>> article, is that on purpose ?
>>
>> More remarks :
>> - In examples, the USING: ... line is not greyed (this is done in word
>> definitions, so I guess it would be easy to do it here?) whichs makes
>> it hard to read.
>> - What's the difference between $unchecked-example and $example ?
>> - There are two articles that still need work : "Tokenizers" and
>> "Foreign Rules". I didn't know what to do with long parser, make the
>> $example or $code...
>>
>> cheers,
>>
>> On Mon, Oct 19, 2009 at 2:33 PM, Chris Double <[email protected]> 
>> wrote:
>>> I've finally written some documentation for the peg.ebnf vocabulary.
>>> This documents the various ways of using it (EBNF:, [EBNF ... ENBF]
>>> and <EBNF ... EBNF>) as well as the syntax for the EBNF language. Let
>>> me know (or provide patches!) if I left anything out or if anything is
>>> badly written.
>>>
>>> You can get it now from the 'ebnf' branch of
>>> git://double.co.nz/git/factor.git or when it gets pulled into the main
>>> Factor repository. When loaded you can read the help from within
>>> factor with:
>>>
>>>  "peg.ebnf" about
>>>
>>> Chris.
>>> --
>>> http://www.bluishcoder.co.nz
>>>
>>> ------------------------------------------------------------------------------
>>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart your
>>> developing skills, take BlackBerry mobile applications to market and stay
>>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>>> http://p.sf.net/sfu/devconference
>>> _______________________________________________
>>> Factor-talk mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>>
>>
>>
>>
>> --
>> Jon Harper
>>
>> ------------------------------------------------------------------------------
>> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
>> is the only developer event you need to attend this year. Jumpstart your
>> developing skills, take BlackBerry mobile applications to market and stay
>> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
>> http://p.sf.net/sfu/devconference
>> _______________________________________________
>> Factor-talk mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart your
> developing skills, take BlackBerry mobile applications to market and stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Factor-talk mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>



-- 
Jon Harper
diff --git a/basis/peg/ebnf/ebnf-docs.factor b/basis/peg/ebnf/ebnf-docs.factor
index 9bfd8ce..b7e56da 100644
--- a/basis/peg/ebnf/ebnf-docs.factor
+++ b/basis/peg/ebnf/ebnf-docs.factor
@@ -274,7 +274,7 @@ ARTICLE: "peg.ebnf.variable" "Variable"
 ;
 
 ARTICLE: "peg.ebnf.foreign-rules" "Foreign Rules"
-"Rules can call outto other peg.ebnf defined parsers. The result of "
+"Rules can call out to other peg.ebnf defined parsers. The result of "
 "the foreign call then becomes the AST of the successful parse. Foreign rules "
 "are invoked using '<foreign word-name>' or '<foreign word-name rule>'. The "
 "latter allows calling a specific rule in a previously designed peg.ebnf parser. "
@@ -283,20 +283,33 @@ ARTICLE: "peg.ebnf.foreign-rules" "Foreign Rules"
 { $vocab-link "peg" } " defined parser and it will be called to perform the parse "
 "for that rule."
 { $examples
+    "Using this peg.ebnf defined parser,"
     { $code 
        "USING: prettyprint peg.ebnf ;"
        "EBNF: parse-string"
        "StringBody = (!('\"') .)*"
        "String= '\"' StringBody:b '\"' => [[ b >string ]]"
        ";EBNF"
+    }
+       "Then the following two parsers are equivalent"
+    { $list
+       { $code
+       "USING: prettyprint peg.ebnf ;"
        "EBNF: parse-two-strings"
        "TwoStrings = <foreign parse-string String> <foreign parse-string String>"
        ";EBNF"
+    }
+       { $code
+       "USING: prettyprint peg.ebnf ;"
        "EBNF: parse-two-strings"
        "TwoString = <foreign parse-string> <foreign parse-string>"
        ";EBNF"
     }
+    }
+    $nl
+    "Using a word returning a peg defined parser :"
     { $code
+       "USING: prettyprint peg.ebnf peg ;"
        ": a-token ( -- parser ) \"a\" token ;"
        "EBNF: parse-abc"
        "abc = <foreign a-token> 'b' 'c'"
@@ -435,32 +448,36 @@ ARTICLE: "peg.ebnf" "EBNF"
 "The " { $vocab-link "peg.ebnf" } " vocabulary provides a DSL that allows writing PEG parsers that look like "
 "EBNF syntax. It provides three parsing words described below. These words all "
 "accept the same EBNF syntax. The difference is in how they are used. "
-{ $subsection POSTPONE: <EBNF }
-{ $subsection POSTPONE: [EBNF }
-{ $subsection POSTPONE: EBNF: }
+{ $subsections
+    POSTPONE: <EBNF
+    POSTPONE: [EBNF
+    POSTPONE: EBNF:
+}
 "The EBNF syntax is composed of a series of rules of the form: "
 { $code 
   "rule1 = ..."
   "rule2 = ..."
 }
+$nl
 "The last defined rule is the main rule for the EBNF. It is the first one run "
 "and it is expected that the remaining rules are used by that rule. Rules may be "
 "left recursive. "
 "Each rule can contain the following: "
-{ $subsection "peg.ebnf.strings" }
-{ $subsection "peg.ebnf.any" }
-{ $subsection "peg.ebnf.sequence" }
-{ $subsection "peg.ebnf.choice" }
-{ $subsection "peg.ebnf.option" }
-{ $subsection "peg.ebnf.one-or-more" }
-{ $subsection "peg.ebnf.zero-or-more" }
-{ $subsection "peg.ebnf.and" }
-{ $subsection "peg.ebnf.not" }
-{ $subsection "peg.ebnf.character-class" }
-{ $subsection "peg.ebnf.foreign-rules" }
-{ $subsection "peg.ebnf.action" }
-{ $subsection "peg.ebnf.semantic-action" }
-{ $subsection "peg.ebnf.variable" }
+{ $subsections 
+    "peg.ebnf.strings"
+    "peg.ebnf.any" 
+    "peg.ebnf.sequence" 
+    "peg.ebnf.choice" 
+    "peg.ebnf.option" 
+    "peg.ebnf.one-or-more" 
+    "peg.ebnf.zero-or-more" 
+    "peg.ebnf.and" 
+    "peg.ebnf.not" 
+    "peg.ebnf.character-class" 
+    "peg.ebnf.foreign-rules" 
+    "peg.ebnf.action" 
+    "peg.ebnf.semantic-action" 
+    "peg.ebnf.variable" }
 "Grammars defined in EBNF need to handle each character, or sequence of "
 "characters in the input. This can be tedious for dealing with whitespace in "
 "grammars that have 'tokens' separated by whitespace. You can define your "
@@ -468,7 +485,7 @@ ARTICLE: "peg.ebnf" "EBNF"
 "those tokens, allowing you to ignore the whitespace issue. The tokenizer "
 "can be changed at various parts in the grammar as needed. The JavaScript grammar "
 "does this to define the optional semicolon rule for example." 
-{ $subsection "peg.ebnf.tokenizers" }
+{ $subsections "peg.ebnf.tokenizers" }
 ;
 
-ABOUT: "peg.ebnf"
\ No newline at end of file
+ABOUT: "peg.ebnf"
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to