In the process of understanding of parse trees to get PIR, I spent some time learning the LALR(1) parsing algorithm which is being used in corellaScript.
Out of the three stages of compiler design, lexical analysing, Parsing, and code generating.
Parsing is the most important one, It is the stage where the token stream generated by lexer is analyzed according to the rules of specified grammar .
Out of the three stages of compiler design, lexical analysing, Parsing, and code generating.
Parsing is the most important one, It is the stage where the token stream generated by lexer is analyzed according to the rules of specified grammar .
corellaScript's parser is an example of bottom-up parser as it attempts to deduce the top level grammar productions by building up from the leaves. The intermediate representaion generated can be represented in a tree form for better understanding.
full post can be read here CorellaScript : LALR parsing and AST
For more details of LALR and LR parsing, wikipedia was a great help . Just read tcurtis's post on LALR parsing which is quite detailed analysis and highlights some very important points as well.