Skip to content

Commit

Permalink
write_tables=False added
Browse files Browse the repository at this point in the history
  • Loading branch information
karlstroetmann committed Nov 5, 2024
1 parent eccb8b0 commit 82533ce
Show file tree
Hide file tree
Showing 7 changed files with 3,240 additions and 822 deletions.
2 changes: 1 addition & 1 deletion Python/Chapter-04-05/RegExp-Parser.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@
"source": [
"def parseProduct(TokenList: list[str]) -> tuple[ParseTree, list[str]]:\n",
" result, Rest = parseFactor(TokenList)\n",
" while len(Rest) > 0 and Rest[0] in string.ascii_letters + '(':\n",
" while len(Rest) > 0 and Rest[0] in string.ascii_letters + '(∅𝜀':\n",
" arg, Rest = parseFactor(Rest)\n",
" result = (result, '⋅', arg)\n",
" return result, Rest"
Expand Down
108 changes: 88 additions & 20 deletions Python/Chapter-06/1-Top-Down-Parser.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,75 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting mypy\n",
" Downloading mypy-1.13.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (2.1 kB)\n",
"Requirement already satisfied: typing-extensions>=4.6.0 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from mypy) (4.11.0)\n",
"Collecting mypy-extensions>=1.0.0 (from mypy)\n",
" Using cached mypy_extensions-1.0.0-py3-none-any.whl.metadata (1.1 kB)\n",
"Downloading mypy-1.13.0-cp312-cp312-macosx_11_0_arm64.whl (10.1 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m10.1/10.1 MB\u001b[0m \u001b[31m16.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m \u001b[36m0:00:01\u001b[0m\n",
"\u001b[?25hUsing cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)\n",
"Installing collected packages: mypy-extensions, mypy\n",
"Successfully installed mypy-1.13.0 mypy-extensions-1.0.0\n"
]
}
],
"source": [
"!pip install mypy"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting nb_mypy\n",
" Using cached nb_mypy-1.0.5-py3-none-any.whl\n",
"Collecting astor<1,>=0.8 (from nb_mypy)\n",
" Using cached astor-0.8.1-py2.py3-none-any.whl.metadata (4.2 kB)\n",
"Requirement already satisfied: mypy<2,>=1 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from nb_mypy) (1.13.0)\n",
"Requirement already satisfied: ipython<9,>=8.0 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from nb_mypy) (8.27.0)\n",
"Requirement already satisfied: decorator in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (5.1.1)\n",
"Requirement already satisfied: jedi>=0.16 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (0.19.1)\n",
"Requirement already satisfied: matplotlib-inline in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (0.1.6)\n",
"Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.41 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (3.0.43)\n",
"Requirement already satisfied: pygments>=2.4.0 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (2.15.1)\n",
"Requirement already satisfied: stack-data in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (0.2.0)\n",
"Requirement already satisfied: traitlets>=5.13.0 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (5.14.3)\n",
"Requirement already satisfied: pexpect>4.3 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from ipython<9,>=8.0->nb_mypy) (4.8.0)\n",
"Requirement already satisfied: typing-extensions>=4.6.0 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from mypy<2,>=1->nb_mypy) (4.11.0)\n",
"Requirement already satisfied: mypy-extensions>=1.0.0 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from mypy<2,>=1->nb_mypy) (1.0.0)\n",
"Requirement already satisfied: parso<0.9.0,>=0.8.3 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from jedi>=0.16->ipython<9,>=8.0->nb_mypy) (0.8.3)\n",
"Requirement already satisfied: ptyprocess>=0.5 in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from pexpect>4.3->ipython<9,>=8.0->nb_mypy) (0.7.0)\n",
"Requirement already satisfied: wcwidth in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from prompt-toolkit<3.1.0,>=3.0.41->ipython<9,>=8.0->nb_mypy) (0.2.5)\n",
"Requirement already satisfied: executing in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from stack-data->ipython<9,>=8.0->nb_mypy) (0.8.3)\n",
"Requirement already satisfied: asttokens in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from stack-data->ipython<9,>=8.0->nb_mypy) (2.0.5)\n",
"Requirement already satisfied: pure-eval in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from stack-data->ipython<9,>=8.0->nb_mypy) (0.2.2)\n",
"Requirement already satisfied: six in /Users/stroetmann/opt/anaconda3/envs/ds/lib/python3.12/site-packages (from asttokens->stack-data->ipython<9,>=8.0->nb_mypy) (1.16.0)\n",
"Using cached astor-0.8.1-py2.py3-none-any.whl (27 kB)\n",
"Installing collected packages: astor, nb_mypy\n",
"Successfully installed astor-0.8.1 nb_mypy-1.0.5\n"
]
}
],
"source": [
"!pip install nb_mypy"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -52,7 +120,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -77,7 +145,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -100,7 +168,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -109,7 +177,7 @@
"['123', '+', '(', '234', '+', '345', '-', '2', '*', '*', '0', ')', '/', '7']"
]
},
"execution_count": 4,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -134,7 +202,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -164,7 +232,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -189,7 +257,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -222,7 +290,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 11,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -258,7 +326,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -292,7 +360,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 13,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -333,7 +401,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -356,7 +424,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -369,7 +437,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand All @@ -378,7 +446,7 @@
"16.37777777777778"
]
},
"execution_count": 13,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -389,7 +457,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand All @@ -398,7 +466,7 @@
"5.377777777777778"
]
},
"execution_count": 14,
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -409,7 +477,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 18,
"metadata": {},
"outputs": [
{
Expand All @@ -418,7 +486,7 @@
"-5.0"
]
},
"execution_count": 15,
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -455,7 +523,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
"version": "3.12.7"
},
"varInspector": {
"cols": {
Expand Down
2 changes: 1 addition & 1 deletion Python/Chapter-06/2-EBNF-Parser.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.6"
"version": "3.12.7"
},
"varInspector": {
"cols": {
Expand Down
Loading

0 comments on commit 82533ce

Please sign in to comment.