-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation setup for xeus-clang-repl
- Loading branch information
1 parent
d91a386
commit 89560e2
Showing
6 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |