構文解析の方法とハッシ関数

最近LR構文解析を説明する教材を読んでいます。
It seems that this is a form of predictive top-down parsing. Given an LL(1) grammar, a table can be constructed such that, given the current token and one character of lookahead, the correct production can be applied. My concern involves the complexity of constructing the table. This requires the first and follow sets of each non-terminal. I am unsure that the first or follow set can be constructed in O(|G||p|), where |G| is the number of productions in the grammar and |p| is the number of non-terminals in each production on average.
Another project involves implementing the MD5 hash algorithm. It seems that four separate boolean F functions are needed. In addition, the input must be broken up into 512-bit blocks, and these must be divided up into 16 32-bit blocks. I believe that 4 128-bit segments of the 512-bit block are used for 16 operations each, where a set of 16 operations is a "round". Each round uses a different F.