Pratt Parsing Index and Updates

The post says that the algorithm is both recursive and iterative, which is a good point.

Here's a related observation that may also help. You can divide recursive algorithms into two categories:

  1. Algorithms where the recursive function is also pure. For example, counting the nodes in a tree is a one-line function that has no variables:
function count(node) {
  return 1 + count(node.left) + count(node.right)
}

  1. Algorithms where state is mutated while recursing. Recursive descent parsing and Pratt Parsing both fall in this category, and that's one thing that makes them harder to understand (and debug).

    In addition to returning or evaluating subexpressions, you advance through the token stream while recursing. This is done in the Next() call on line 222 of tdop.py. Note that ParseUntil() and the set of nud() / led() functions are mutually recursive.

    The continue statement in C programming works somewhat like the break statement. Instead of forcing termination, it forces the next iteration of the loop to take place, skipping any code in between.

    In canonical mode also called cooked mode, keyboard input is only sent to your program when the user presses Enter. This is useful for many programs: it lets the user type in a line of text, use Backspace to fix errors until they get their input exactly the way they want it, and finally press Enter to send it to the program.

    -Wikipedia- A terminal mode is one of a set of possible states of a terminal or pseudo terminal character device in Unix-like systems and determines how characters written to the terminal are interpreted. In cooked mode data is preprocessed before being given to a program, while raw mode passes the data as-is to the program without interpreting any of the special characters.

    Nullglob is what you're looking for. Nullglob, quoting shopts man page, “allows filename patterns which match no files to expand to a null string, rather than themselves”.

    Exit codes with special meanings

exit status : The value returned by a command to its caller. The value is restricted to eight bits, so the maximum value is 255.

Bash command line exit codes demystified

shell arithmetic operator:

"&&" is used to chain commands together, such that the next command is run if and only if the preceding command exited without errors (or, more accurately, exits with a return code of 0).

July 8, 2021 3:42 PM (GMT+1)July 8, 2021 3:42 PM (GMT+1)July 8, 2021 3:42 PM (GMT+1)

The right side of && will only be evaluated if the exit status of the left side is zero (i.e. true). is the opposite: it will evaluate the right side only if the left side exit status is non-zero (i.e. false).||

July 8, 2021 3:42 PM (GMT+1)July 8, 2021 3:42 PM (GMT+1)July 8, 2021 3:42 PM (GMT+1)

$ false && echo howdy!

$ true && echo howdy! howdy! $ true echo howdy!

$ false echo howdy! howdy!

<aside> 💡 "A ; B" Run A and then B, regardless of success of A "A && B" Run B if A succeeded "A || B" Run B if A failed "A &" Run A in background.

</aside>