]> gitweb.factorcode.org Git - factor.git/commitdiff
peg: Add documentation for PEG:
authorGiftpflanze <gifti@tools.wmflabs.org>
Tue, 6 Dec 2022 20:21:39 +0000 (20:21 +0000)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 6 Dec 2022 20:51:08 +0000 (12:51 -0800)
basis/peg/peg-docs.factor

index d21240f2450b0f2bb8f91e7653bdf92364d5b4ab..5a2700bc9ff2b5ca93bc040e7dd22c5c8ed5d7a0 100644 (file)
@@ -178,3 +178,13 @@ HELP: box
     "should return the constructed parser and is called when the parser is compiled. "
     "The compiled result is memoized for future runs. See " { $link delay } " for a word "
     "that calls the quotation at runtime." } ;
+
+HELP: PEG:
+{ $syntax "PEG: word ( stack -- effect ) definition... ;" }
+{ $description "Defines a word that when called will parse a string using the syntax"
+    "defined by the parser created by the definition. The definition should have stack"
+    "effect " { $snippet "( -- parser )" } " and the created word "
+    { $snippet "( string -- ast )" } ". In contrast to calling the parser resulting from"
+    "the definition with " { $link parse } ", the parser is pre-compiled and not compiled"
+    "for each invocation of " { $link parse } ". If the parsing fails, the word throws an"
+    "exception." } ;