So here is what I have done:
Step 1
I have the following environment:
> llvm-tblgen --version
LLVM (http://llvm.org/):
LLVM version 16.0.6
Optimized build with assertions.
> python --version
Python 3.10.8
> jupyter --version
Selected Jupyter core packages...
IPython : 8.14.0
ipykernel : 6.23.3
ipywidgets : not installed
jupyter_client : 8.3.0
jupyter_core : 5.3.1
jupyter_server : not installed
jupyterlab : not installed
nbclient : not installed
nbconvert : not installed
nbformat : not installed
notebook : not installed
qtconsole : not installed
traitlets : 5.9.0
Further, since I built LLVM 16.x locally, with the built binaries under the directory llvm-project/installed
, I have set the following environment variables:
> echo $PATH
<user home>/llvm-project/installed:<other stuff>
> echo $LLVM_TBLGEN_EXECUTABLE
<user home>/llvm-project/installed/llvm-tblgen
> echo $PYTHONPATH
<user home>/llvm-project/llvm/utils/TableGen/jupyter
Step 2
I moved to the path: llvm-project/llvm/utils/TableGen/jupyter/
I first executed the command:
> python -m tablegen_kernel.install
Installing llvm-tblgen IPython kernel spec
> jupyter kernelspec list
Available kernels:
python3 <user home>/custom_py_envs/py310env/share/jupyter/kernels/python3
tablegen <user home>/.local/share/jupyter/kernels/tablegen
Step 3
In my VSCODE, I launched the LLVM_TableGen.ipynb
notebook. I executed the very first block:
%reset
// This is some tablegen
class Foo {}
It gave me the following output:
Cell In[8], line 2
// This is some tablegen
^
SyntaxError: invalid syntax
Errors printed to stderr are shown.
I believe the correct output should have been:
------------- Classes -----------------
class Foo {
}
------------- Defs -----------------
Errors printed to stderr are shown.
Please help me understand what mistake I made in setting up the TableGen playground.