In our former series of articles, we looked at the basics of lexical analysis. In this article, we will start the series concerning syntax analysis. In the first article concerning lexical analysis, we said that we can identify tokens/patterns with the help of regular expressions and pattern rules. There is, though, a limit to lexical analysis — while we can look at the individual tokens, but it cannot check the syntax of a given sentence. Therefore, we need syntax analysis. We will start by giving both an informal and formal definition of context-free grammar.

Defining Context-Free Grammar

Imagine that you…

Naja Møgeltoft

Data science and Machine Learning student at Copenhagen University.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store