Head First Lexical Analysis(1)

In general, lexical analysis is the process that transform the input source program to token stream, which later will be used by parser to produce syntax tree. Nowadays, a technique called Parser Combinator may blur the boundary between parsers and lexers. However, how to use a Parser Combinator efficiently still demands a good knowledge of lexers. Besides, a Parser Combinator is LL(k), that means you have to manually eliminate left recursion....

January 19, 2021 · 11 min · 2237 words · ChroniCat

Notes on Generating Functions and Character Polynomial

Notes on Generating Functions and Character Polynomial Generating Functions Generating Functions are formal power series that play important roles in Combinatorics. Specifically, We may assume that a generating functions should look like this: $$ g(x ) = u_0+u_1x+u_2x^2+\cdots + u_nx^n+\cdots. \tag{1} $$ Suppose that there is another generating function: $$ f(x)=v_0+v_1x+v_2x^2+\cdots + v_nx^n+\cdots. \tag{2} $$ It’s easy to find that we can define the multiply two generating functions the way we define convergence:...

September 14, 2020 · 3 min · 534 words · ChroniCat

CPS Tutorial For Kindergarteners

“It was a detour that was our shortest path” ——Julius·Caesar·Zeppeli Continuation Edgar Dijkstra once serverely critisized the excessive use of goto statement in programming for that code that uses goto statements is harder to understand than alternative constructions. When I was still a freshman, I really found myself confused by that—— what can I do without goto? Well, your software teacher might have told you that, by structured program theorem, the goto statement in programs which can be expressed as flowchart can be avoided by using the combination of the three programming constructs of sequence , selection/choice, and repetition/iteration despite the fact that code duplication and additional variables may need to be introduced....

April 1, 2020 · 17 min · 3449 words · ChroniCat