2016-08-05 16:10:24 +03:00
Cling - The Interactive C++ Interpreter
=========================================
2014-09-25 22:44:22 +04:00
2017-05-21 00:47:32 +03:00
The main repository is at [https://github.com/root-project/cling ](https://github.com/root-project/cling )
2016-08-05 15:57:56 +03:00
2016-08-05 16:10:24 +03:00
Overview
--------
2016-08-05 15:57:56 +03:00
Cling is an interactive C++ interpreter, built on top of Clang and LLVM compiler
infrastructure. Cling realizes the [read-eval-print loop
(REPL)](http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop)
concept, in order to leverage rapid application development. Implemented as a
small extension to LLVM and Clang, the interpreter reuses their strengths such
as the praised concise and expressive compiler diagnostics.
2014-05-30 13:02:36 +04:00
2022-01-11 20:05:16 +03:00
See also [cling's web page. ](https://rawcdn.githack.com/root-project/cling/d59d27ad61f2f3a78cd46e652cd9fb8adb893565/www/index.html )
2016-08-05 15:57:56 +03:00
Please note that some of the resources are rather old and most of the stated
limitations are outdated.
2016-07-22 12:17:40 +03:00
* [talks ](www/docs/talks )
2014-08-04 06:05:42 +04:00
* http://blog.coldflake.com/posts/2012-08-09-On-the-fly-C++.html
* http://solarianprogrammer.com/2012/08/14/cling-cpp-11-interpreter/
* https://www.youtube.com/watch?v=f9Xfh8pv3Fs
* https://www.youtube.com/watch?v=BrjV1ZgYbbA
* https://www.youtube.com/watch?v=wZZdDhf2wDw
* https://www.youtube.com/watch?v=eoIuqLNvzFs
2014-05-30 13:02:36 +04:00
2016-08-05 15:57:56 +03:00
2016-08-05 16:10:24 +03:00
Installation
------------
### Release Notes
See our [release notes ](docs/ReleaseNotes.md ) to find what's new.
2016-08-05 15:57:56 +03:00
2016-08-05 16:10:24 +03:00
### Binaries
2016-08-05 15:57:56 +03:00
Our nightly binary snapshots can be found
2016-08-07 21:47:59 +03:00
[here ](https://root.cern.ch/download/cling/ ).
2016-08-05 15:57:56 +03:00
2012-09-05 13:37:39 +04:00
2016-08-05 15:48:18 +03:00
### Building from Source with Cling Packaging Tool
2014-08-16 14:07:20 +04:00
Cling's tree has a user-friendly, command-line utility written in Python called
Cling Packaging Tool (CPT) which can build Cling from source and generate
2021-03-05 10:38:08 +03:00
installer bundles for a wide range of platforms. CPT requires Python 3 or
2016-08-05 15:57:56 +03:00
later.
2014-08-16 14:07:20 +04:00
If you have Cling's source cloned locally, you can find the tool in
2016-08-05 15:57:56 +03:00
`tools/packaging` directory. Alternatively, you can download the script
manually, or by using `wget` :
2014-08-16 14:07:20 +04:00
```sh
2017-04-05 11:27:44 +03:00
wget https://raw.githubusercontent.com/root-project/cling/master/tools/packaging/cpt.py
2014-08-16 14:07:20 +04:00
chmod +x cpt.py
2016-08-05 15:48:18 +03:00
./cpt.py --check-requirements & & ./cpt.py --create-dev-env Debug --with-workdir=./cling-build/
2014-08-16 14:07:20 +04:00
```
2016-08-05 17:54:25 +03:00
Full documentation of CPT can be found in [tools/packaging ](tools/packaging ).
2016-08-05 16:10:24 +03:00
2016-08-07 20:20:59 +03:00
Usage
-----
2016-04-09 12:27:14 +03:00
```c++
2017-04-09 14:26:08 +03:00
./cling '#include < stdio.h > ' 'printf("Hello World!\n")'
2016-04-09 12:27:14 +03:00
```
To get started run:
```bash
2017-04-09 14:26:08 +03:00
./cling --help
2016-04-09 12:27:14 +03:00
```
or type
```
2016-08-07 20:20:59 +03:00
./cling
2017-04-09 14:26:08 +03:00
[cling]$ .help
2016-04-09 12:27:14 +03:00
```
2014-03-04 18:23:17 +04:00
2016-08-05 15:57:56 +03:00
2016-08-05 16:10:24 +03:00
Jupyter
-------
2016-08-05 15:57:56 +03:00
Cling comes with a [Jupyter ](http://jupyter.org ) kernel. After building cling,
2018-06-14 09:57:11 +03:00
install Jupyter and cling's kernel by following the README.md in
2018-06-12 11:37:50 +03:00
[tools/Jupyter ](tools/Jupyter ). Make sure cling is in your PATH when you start jupyter!
2016-04-09 12:27:14 +03:00
2016-01-07 17:58:40 +03:00
2019-04-09 22:38:23 +03:00
Citing Cling
------------
```latex
% Peer-Reviewed Publication
%
% 19th International Conference on Computing in High Energy and Nuclear Physics (CHEP)
% 21-25 May, 2012, New York, USA
%
@inproceedings {Cling,
author = {Vassilev,V. and Canal,Ph. and Naumann,A. and Moneta,L. and Russo,P.},
title = {{Cling} -- The New Interactive Interpreter for {ROOT} 6}},
journal = {Journal of Physics: Conference Series},
year = 2012,
month = {dec},
volume = {396},
number = {5},
pages = {052071},
doi = {10.1088/1742-6596/396/5/052071},
url = {https://iopscience.iop.org/article/10.1088/1742-6596/396/5/052071/pdf},
publisher = {{IOP} Publishing}
}
```
2016-08-05 16:10:24 +03:00
Developers' Corner
==================
[Cling's latest doxygen documentation ](http://cling.web.cern.ch/cling/doxygen/ )
2016-08-05 15:57:56 +03:00
2016-01-07 17:58:40 +03:00
2016-08-05 16:10:24 +03:00
Contributions
-------------
2016-08-07 19:45:08 +03:00
Every contribution is considered a donation and its copyright and any other
related rights become exclusive ownership of the person who merged the code or
in any other case the main developers of the "Cling Project".
We warmly welcome external contributions to the Cling! By providing code,
you agree to transfer your copyright on the code to the "Cling project".
Of course you will be duly credited and your name will appear on the
contributors page, the release notes, and in the [CREDITS file ](CREDITS.txt )
shipped with every binary and source distribution. The copyright transfer is
necessary for us to be able to effectively defend the project in case of
litigation.
2016-08-05 16:30:57 +03:00
License
-------
Please see our [LICENSE ](LICENSE.TXT ).
2016-08-09 22:10:36 +03:00
Releases
--------
Our release steps to follow when cutting a new release:
1. Update [release notes ](docs/ReleaseNotes.md )
2016-08-09 22:44:01 +03:00
2. Remove `~dev` suffix from [VERSION ](VERSION )
2016-08-09 22:10:36 +03:00
3. Add a new entry in the news section of our [website ](www/news.html )
4. Commit the changes.
5. `git tag -a v0.x -m "Tagging release v0.x"`
2021-01-12 20:23:07 +03:00
6. Tag `cling-patches` of `clang.git` :
`git tag -a cling-v0.x -m "Tagging clang for cling v0.x"`
7. Create a draft release in github and copy the contents of the release notes.
8. Wait for green builds.
9. Upload binaries to github (Travis should do this automatically).
10. Publish the tag and announce it on the mailing list.
11. Increment the current version and append `~dev` .