Skip to content

Commit

Permalink
Update with cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Krishna-13-cyber committed Aug 22, 2023
1 parent 0700502 commit d40727b
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 24 deletions.
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ find_package(xeus ${xeus_REQUIRED_VERSION} REQUIRED)
find_package(cppzmq REQUIRED CONFIG)
find_package(pugixml REQUIRED)

#find_package(LLVM REQUIRED CONFIG PATHS "${LLVM_CONFIG_EXTRA_PATH_HINTS}" NO_DEFAULT_PATH)
#find_package(Clang REQUIRED CONFIG PATHS "${LLVM_CONFIG_EXTRA_PATH_HINTS}/lib/cmake/clang/" NO_DEFAULT_PATH)
find_package(LLVM ${llvm_REQUIRED_VERSION} REQUIRED CONFIG PATHS "${LLVM_CONFIG_EXTRA_PATH_HINTS}")
find_package(Clang REQUIRED CONFIG PATHS "${LLVM_BINARY_DIR}/lib/cmake/clang/" "${LLVM_CONFIG_EXTRA_PATH_HINTS}/lib/cmake/clang/" NO_DEFAULT_PATH)
include_directories(SYSTEM ${LLVM_INCLUDE_DIRS} ${CLANG_INCLUDE_DIRS})
link_directories(${LLVM_LIBRARY_DIR})

#CppInterOp
#TODO: Make CppInterOp cmake package and use find_package
#find_package(CppInterOp REQUIRED CONFIG PATHS "${CPPINTEROP_DIR}")
Expand All @@ -75,6 +68,8 @@ message(STATUS "CppInterOp Imported location: ${CPPINTEROP_DIR}/lib/libclangCppI
message(STATUS "CppInterOp include location: ${CPPINTEROP_DIR}/../include")


###

# Before including llvm suppress the option() honors normal variables warning.
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
Expand Down
22 changes: 19 additions & 3 deletions docs/FAQ.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ FAQ
- **What is Xeus-Clang-REPL?**
Xeus-Clang-REPL is an interactive programming environment that allows you to
execute C++ code in a Jupyter Notebook using the Clang-REPL interpreter.

- Xeus: Xeus is part of the Jupyter ecosystem, which is known for creating
interactive notebooks that can include code, visualizations, and narrative text.
- Clang: Clang is a C/C++ compiler front-end that is part of the LLVM project.
It's known for its fast compilation times and high-quality diagnostics.
- REPL: REPL stands for Read-Eval-Print Loop. It's an interactive programming
environment.

- **How do I install and build from source the Xeus-Clang-REPL?**
Installation instructions can typically be found in the project's documentation.
Expand All @@ -12,14 +19,23 @@ FAQ
- **What are the benefits of using Xeus-Clang-REPL?**
You can interactively run and debug C++ code in a Jupyter notebook.
You can use xeus-clang-repl to prototype C++ code quickly and easily.
- Rapid Prototyping: Quickly prototype and experiment with C++ code without
the need to create a full project or compile an entire codebase.
- Immediate Feedback: As a REPL, Xeus-Clang provides instant feedback as you
write and execute code. This helps catch errors early.
- Interactive Learning: Xeus-Clang-REPL allows learners to interactively
explore C++ concepts and practice coding in a controlled environment.
- Debugging: By isolating and testing specific pieces of code, you can more
easily identify and fix issues in small code snippets.


- **How do I create a new session?**
To create a new Xeus-Clang-REPL session, you would open Jupyter Notebook,
To create a new Xeus-Clang-REPL session, you simply open Jupyter Notebook,
select the appropriate kernel, and create a new notebook file.

- **Where can I find documentation and examples for Xeus-Clang-REPL?**
Documentation, tutorials, and references can be found on this Documentation
itself, :doc:`Documentation <DevelopersDocumentation>`.
Documentation, tutorials, and references can other directories of current
documentation, i.e :doc:`Documentation <DevelopersDocumentation>`.

- **How do I contribute to the project?**
Instructions for reporting issues and contributing to the project are
Expand Down
39 changes: 30 additions & 9 deletions docs/UsingXeus-Clang-REPL.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
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.
- Rapid Iteration:
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.
- Python-C++ Binding:
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.
- Magic Commands:
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.

- Learning and Teaching:
C++ enthusiasts can use it to explain and experiment with C++ concepts in a live,
interactive manner. Students can follow along and test code snippets in real-time,
improving their understanding of C++. This also applies to C++ workshops and
coding boot camps.

- Exploring C++ Libraries:
You can explore the vast set of C++ libraries and frameworks without having to
create a complete project. This allows you to quickly assess whether a library
suits your needs by experimenting with its functions and classes.

- Collaborative Coding:
Xeus-clang-repl can act as a shared environment where team members can experiment,
debug, and discuss code in real-time.

- Debugging and Testing:
You can isolate problematic code segments, experiment with multiple inputs, and
interactively walk through your code to identify and fix the issues.
4 changes: 2 additions & 2 deletions docs/reference.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Reference
---------
References
----------

1. `Xeus-cling <https://github.com/jupyter-xeus/xeus-cling>`_
Xeus-cling offers a similar interactive experience as xeus-clang-repl but uses
Expand Down
27 changes: 24 additions & 3 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
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.
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.

Expand Down Expand Up @@ -49,6 +49,27 @@ 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++.

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

We are taking another example of working with functions that can be used in
to call functions defined in C++ in python code with help of magic commands.

.. code-block:: bash
In[1] #include <iostream>
In[2] void Cpp() {
std::cout << "Hello World C++!" << std::endl;
}
In[3] %%python
In[4] Cpp()
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++
Expand Down

0 comments on commit d40727b

Please sign in to comment.