Syntax Analysis in Compiler Design (Parsers)

Parser for A Chat Program using ANTLR Parser Generator

Roland Hewage
Webtips

--

Syntax Analysis in Compiler Design (Parsers)

What is Syntax Analysis (Parsing)?

https://media.geeksforgeeks.org/wp-content/uploads/compilerDesign.jpg

Syntax analysis (Parsing) is the second phase of the compiler design process that comes after lexical analysis. It analyses the syntactical structure of the given input. It checks if the given input is in the correct syntax of the programming language in which the input has been written (confirming to the grammar of the programming language). A Parse Tree is generated with the predefined grammar of the programming language and the syntax analyzer (parser) checks whether a given program conforms to the grammar. If it confirms, the parser then creates the parse tree of that source program else it will display error messages.

Difference Between Top-down Parsing and Bottom-up Parsing Technique

Difference Between Top-down Parsing and Bottom-up Parsing Technique

Top-Down Parsing

--

--

Roland Hewage
Webtips

(Born to Code) | Software Engineer (Ecosystem Engineering) at WSO2 | Bachelor of Computer Science (Special) Degree Graduate at University of Ruhuna, Sri Lanka