bnf syntax and parsing terminology writing handcrafted parsers pythonic parsing with pyparsing lex/yacc-style parsing with ply introduction to parsing |||parsing is fundamental activity in many programsand for all but the most trivial casesit is challenging topic parsing is often done when we need to read data that is stored in custom format so that we can process it or perform queries on it or we may be required to parse dsl (domain-specific language)--these are mini task-specific languages that appear to be growing in popularity whether we need to read data in custom format or code written using dslwe will need to create suitable parser this can be done by handcraftingor by using one of python' generic parsing modules python can be used to write parsers using any of the standard computer science techniquesusing regexesusing finite state automatausing recursive descent parsersand so on all of these approaches can work quite wellbut for data or dsls that are complex--for examplerecursively structured and featuring operators that have different precedences and associativities--they can be challenging to get right alsoif we need to parse many different data formats or dslshandcrafting each parser can be time-consuming and tedious to maintain fortunatelyfor some data formatswe don' have to write parser at all for examplewhen it comes to parsing xmlpython' standard library comes with domsaxand element tree parserswith other xml parsers available as third-party add-ons file formats dynamic code execution in factpython has built-in support for reading and writing wide range of data formatsincluding delimiter-separated data with the csv modulewindows-style ini files with the configparser modulejson data with the json moduleand also few othersas mentioned in python does not provide any built-in support for parsing other languagesalthough it does provide the shlex module which can be used to create lexer for unix shelllike mini-languages (dsls)and the tokenize module that provides lexer for python source code and of coursepython can execute python code using the built-in eval(and exec(functions