Posts

ANTLR with Python 3 Example: Parsing English Sentences

Overview In this blog post, I will introduce you all to a open-source parser generator called ANTLR (pronounced ant-ler) with a simple programming question that I encountered on a job interview. Who this tutorial is intended for Someone who... Knows what a compiler is I mean if you are delving into parser generators like ANTLR... ;) Knows decent programming in Python We will be using Python 3 and its type annotation (only syntax sugar for now) Understands object-oriented programming Classes are everywhere Understands data structures Trees are enough Is comfortable with regular expressions You can write a regular expression for simple things like floating point numbers. Has basic knowledge of context-free grammar Just know what it is conceptually. Software needed to follow this tutorial ANTLR v4 (latest version as of February 2020) Set up your classpath as described after downloading the Jar file. Python 3 (version 3.8 used here) The global
Recent posts