Skip to content

Commit

Permalink
Guard against Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-zeller committed Oct 15, 2023
1 parent e5f538f commit c3b505d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions notebooks/PythonFuzzer.ipynb
Expand Up @@ -10,6 +10,7 @@
"# Testing Compilers\n",
"\n",
"In this chapter, we will make use of [grammars and grammar-based testing](Grammars.ipynb) to systematically generate _program code_ – for instance, to test a compiler or an interpreter. Not very surprising, we use _Python_ and the _Python interpreter_ as our domain.\n",
"\n",
"We chose Python not only because the rest of the book is also based on Python.\n",
"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.\n",
"This allows us to leverage grammars that operate on ASTs rather than concrete syntax, greatly reducing complexity."
Expand All @@ -25,6 +26,30 @@
"* You must read the chapter on [Fuzzing with Grammars](Grammars.ipynb) to understand how grammars and grammar-based testing work."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9eadd112",
"metadata": {},
"outputs": [],
"source": [
"# ignore\n",
"import sys"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4cea401a",
"metadata": {},
"outputs": [],
"source": [
"# ignore\n",
"if sys.version_info < (3, 10):\n",
" print(\"This code requires Python 3.10 or later\")\n",
" sys.exit(0)"
]
},
{
"cell_type": "markdown",
"id": "6891d8a0",
Expand Down

0 comments on commit c3b505d

Please sign in to comment.