on master help sign in
Fixed example in parsing.md

example used `lit` and `rit` where `pal` and `par` are proper now. example previously had a syntax error on line 2: `|^ (scan xprs tape)` corrected to `|^ (scan xprs expr)`

commitac1a31cce3a0c866e4a7938887df6fd9c17fd193 authorrisruc-habteb <58319961+risruc-habteb@users.noreply.github.com> dateTue 19 Jan 2021, 12:22 (6 years ago) parent499160b
1 file changed+8−8
tutorials/hoon/parsing.md+8−8
tutorials/hoon/parsing.md+8−8
@@ -321,10 +321,10 @@ documented among the [parser builders](@/docs/reference/library/4f.md).
321321surrounded on both sides by text that matches a pair of `rule`s, which is discarded.
322322
323323```
324−> (scan "(42)" (ifix [lit rit] (jest '42')))
324+> (scan "(42)" (ifix [pal par] (jest '42')))
325325'42'
326326```
327−`+lit` and `+rit` are shorthand for `(just '(')` and `(just ')')`, respectively. All
327+`+pal` and `+par` are shorthand for `(just '(')` and `(just ')')`, respectively. All
328328ASCII glyphs have counterparts of this sort, documented
329329[here](@/docs/reference/library/4h.md).
330330
@@ -520,13 +520,13 @@ your `gen/` folder.
520520:: expr-parse: parse arithmetic expressions
521521::
522522|= xprs=tape
523−|^ (scan xprs tape)
523+|^ (scan xprs expr)
524524++ factor
525525 %+ knee *@ud
526526 |. ~+
527527 ;~ pose
528528 dem
529− (ifix [lit rit] expr)
529+ (ifix [pal par] expr)
530530 ==
531531++ turm
532532 %+ knee *@ud
@@ -563,15 +563,15 @@ for expressions.
563563 |. ~+
564564 ;~ pose
565565 dem
566− (ifix [lit rit] expr)
566+ (ifix [pal par] expr)
567567 ==
568568```
569569
570570A _factor_ is either a decimal number or an expression surrounded by parentheses. Put
571571into Hoon terms, a decimal number is parsed by the `rule` `+dem` and an
572572expression is parsed by removing the surrounding parentheses and then passing
573−the result to the expression parser arm `+expr`, given by the `rule` `(ifix [lit
574−rit] expr)`. Since we want to parse our expression with one or the other, we
573+the result to the expression parser arm `+expr`, given by the `rule` `(ifix [pal
574+par] expr)`. Since we want to parse our expression with one or the other, we
575575chain these two `rule`s together using the monadic applicator rune `;~` along
576576with `+pose`, which says to try each rule in succession until one of them works.
577577
@@ -584,7 +584,7 @@ Then follows the definition of the gate utilized by `+knee`:
584584 |. ~+
585585 ;~ pose
586586 dem
587− (ifix [lit rit] expr)
587+ (ifix [pal par] expr)
588588 ==
589589```
590590`~+` is used to cache the parser, so that it does not need to be computed over