Loading [MathJax]/extensions/Safe.js
Testing Compilers In this chapter, we will make use of grammars and grammar-based testing to systematically generate program code – for instance, to test a compiler or an interpreter. Not very surprisingly, we use Python and the Python interpreter as our domain. We chose Python not only because the rest of the book is also based on Python. Most importantly, Python brings lots of built-in infrastructure we can leverage, especially parsers that convert Python code into an abstract syntax tree (AST) representation and unparsers that take an AST and convert it back into Python code. This allows us to leverage grammars that operate on ASTs rather than concrete syntax, greatly reducing complexity.