Skip to content

Commit

Permalink
Add documentation setup for xeus-clang-repl
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishna-13-cyber committed Aug 15, 2023
1 parent d91a386 commit 89560e2
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 4 deletions.
6 changes: 3 additions & 3 deletions docs/InstallationAndUsage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ The safest usage is to create an environment named `xeus-clang-repl`.

.. code-block:: bash
mamba create -n `xeus-clang-repl`
source activate `xeus-clang-repl`
mamba create -n xeus-clang-repl
source activate xeus-clang-repl
Installing from conda-forge:
Then you can install in this environment `xeus-clang-repl` and its dependencies.

.. code-block:: bash
mamba install`xeus-clang-repl` notebook -c conda-forge
mamba install xeus-clang-repl notebook -c conda-forge
.. code-block:: bash
Expand Down
11 changes: 11 additions & 0 deletions docs/UsingXeus-Clang-REPL.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
Using xeus-clang-repl
---------------------

- With xeus-clang-repl, you can write and execute C++ code interactively, seeing
the results immediately. This REPL nature allows you to iterate quickly
without the overhead of compiling and running separate C++ programs.

- To achieve C++ and Python integration within a Jupyter environment we can use
xeus-clang-repl. Thereby you can write and execute C++ code interactively in
this environment.

- Jupyter notebooks support magic commands (**%%python**) and inline code
execution for different languages. We use these features to run Python and C++
code in separate cells to achieve interactive communication between them.


Binary file added docs/integration-demo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ Reference
---------

1. `Xeus-cling <https://github.com/jupyter-xeus/xeus-cling>`_
Xeus-cling offers a similar interactive experience as xeus-clang-repl but uses
Cling as the interpreter. It allows you to write and execute C++ code
interactively within Jupyter notebook.

2. `Jupyter-xeus <https://github.com/jupyter-xeus/xeus>`_
Xeus is a library meant to facilitate the implementation of kernels for Jupyter.
It takes the responsibility of implementing the Jupyter Kernel protocol.

3. `Xeus-cpp <https://github.com/compiler-research/xeus-cpp>`_
Xeus-cpp is a Jupyter kernel that provides an interactive C++ environment
within Jupyter notebook.
Binary file added docs/sum.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 52 additions & 1 deletion docs/tutorials.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,55 @@
Tutorials
---------

Add tutorials
This tutorial emphasises the abilities and usage of Xeus-Clang-REPL. Let's get
started! The tutorial demonstrates examples of C++ and C++-python integration
on Jupyter kernels.

1. Install the xeus-clang-repl using conda forge (from source) or run it using the
Dockerfile.

2. Launch the Jupyter Notebook with C++-14, C++-17 kernels available.

3. In a code cell, write the C++ code.

4. Run the code cell. The xeus-clang-repl kernel will compile and execute the code.
The output would be displayed below the respective cell.

C++
===

.. image:: sum.png
:width: 200px
:height: 100px
:scale: 250 %
:align: center

In this example, you can modify the code and execute the cell again to see the
updated results. For example, you might change the values of `a` and `b`
(function arguments) of the function `sum` to see expected output. You can try
out different examples to explore the features of C++.

The output of the cell will be displayed below once the code is executed and
xeus-clang-repl provides an interactive environment, where you can promptly make
the changes and prototype in C++.

C++-Python Integration:
=======================

.. image:: integration-demo.png
:width: 200px
:height: 100px
:scale: 400 %
:align: center

In this example, we are emphasising the concept of C++-Python integration, where
we use Python and C++ in the same session, sharing variables, scopes, and features.
Here, we have used variables (`new_var1`, `new_var2`, `new_var3`)
in python which have been initialised in C++. In the following context, we have
tried the vice versa as well of using the variables in Python (`new_python_var`)
which have been defined in C++.

The project is under development and is subject to changes as C++-Python integration
within the same Jupyter cell is quite challenging. Please ensure that you have
xeus-clang-repl and your Jupyter environment set up before attempting to run C++
code. The installation instructions can be found in this documentation for xeus-clang-repl.

0 comments on commit 89560e2

Please sign in to comment.