A Jupyter kernel for the Egison programming language (version 5).
Provides syntax highlighting in Jupyter notebooks via a CodeMirror mode that supports Egison 5 syntax including type classes, inductive data types, type annotations, and pattern matching.
cd egison-jupyter
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install .pip install jupyter
python -m egison_kernel.installpip install jupyterlab
cd jupyterlab-egison
pip install -e .If you modify the CodeMirror mode source (jupyterlab-egison/src/index.ts), rebuild and reinstall the extension, then restart Jupyter:
cd jupyterlab-egison
jlpm build:lib && jlpm build:labextension:dev
pip install -e .Then restart Jupyter Notebook (Ctrl+C to stop, then jupyter notebook again).
Make sure the virtual environment is activated, then start Jupyter:
source .venv/bin/activate
jupyter notebook
# In the notebook interface, select Egison from the 'New' menuThe CodeMirror mode supports Egison 5 syntax:
- Type system keywords:
class,instance,inductive,extends,declare - Definition keywords:
def,let,in,where - Pattern matching:
match,matchAll,matchDFS,matchAllDFS,as,with,loop,forall - Built-in types:
Integer,MathExpr,Float,Bool,Char,String,IO,Tensor,Vector,Matrix,DiffForm,Matcher,Pattern,List - Pattern variables (
$x), value patterns (#x) - Comments: line comments (
--) and nested block comments ({- -}) - Tensor index notation and mathematical symbols
- Greek letters are treated as regular identifiers (no special highlighting)
- Egison 5.x installed and available in PATH
- Python 3
- Jupyter Notebook or JupyterLab
I learned how to implement a Jupyter kernel from bash_kernel.
I thank Shunsuke Gotoh for his article on the initial Python program of this kernel.
