Norvell Article also leads to it
Bottom Up Methods
Pratt parsing and precedence climbing are both http://eli.thegreenplace.net/2009/03/20/a-recursive-descent-parser-with-an-infix-expression-evaluator/
I sent this to someone.
Python: grammar method with LL() parser pgen.c
recursive descent: wirth method?
TODO: Send me links to how your favorite programming language does it! I will put them here.
Or edit the Wiki:
busybox has a clone of GNU expr I believe
dash
mksh
zsh
I contributed code to toybox using Pratt parsing/precedence climbing
clang
gcc ?
Hand-written or generated?
If hand-written, top-down or bottom-up?
Pratt Parsing is easiest.
They are all kind of the same?
For reference, here are two articles on other methods for
Other articles:
precedence climbing eliben -- he agreed it was the same
Wirth method
For example, here's expr.c in bash. You can see from these function prototypes that it uses plain recursive descent to encode precedence. This works fine, but results in more code, and in theory it's less efficient. Processing a single token requires making make dozens of function calls.
static intmax_t expcomma __P((void));
static intmax_t expassign __P((void));
static intmax_t expcond __P((void));
static intmax_t explor __P((void));
static intmax_t expland __P((void));
static intmax_t expbor __P((void));
static intmax_t expbxor __P((void));
static intmax_t expband __P((void));
static intmax_t exp5 __P((void));
static intmax_t exp4 __P((void));
static intmax_t expshift __P((void));
static intmax_t exp3 __P((void));
static intmax_t exp2 __P((void));
static intmax_t exppower __P((void));
static intmax_t exp1 __P((void));
static intmax_t exp0 __P((void));