cling/www/index.html
Axel Naumann 9c6c792a8d dos2unix
2013-05-03 14:14:17 +02:00

165 lines
8.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Cling Website</title>
<meta name="description" content="Official website of Cling" />
<meta name="keywords" content="cling, interactive compiler interface, interpreter, clang, LLVM" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="robots" content="noindex,nofollow" />
<link rel="stylesheet" type="text/css" href="style/style.css" />
<link rel="stylesheet" type="text/css" href="style/menu.css" />
</head>
<body>
<div id="website">
<div id="header">
<div id="logo">
<div id="logo_text">
<!-- class="logo_colour", allows you to change the colour of the text -->
<h1><a href="index.html"><span class="logo_colour">Cling</span> Website</a></h1>
<h2>Interactive Compiler Interface</h2>
</div>
</div>
<div id="mainmenubar">
<ul id="mainmenu">
<!-- put class="selected" in the li tag for the selected page - to highlight which page you're on -->
<li class="selected"><a class="tab_link" href="index.html">Home</a></li>
<li><a class="tab_link" href="download.html">Download</a></li>
<li><a class="tab_link" href="news.html">News</a></li>
<li class="root"><a class="tab_link" href="docs.html">Docs</a>
<div id="secondarymenu">
<div id="secondarymenu_content">
<div class="secondarymenu_header">Documentation</div>
<br class="clear" />
<div class="column">
<div class="column_header">Developer</div>
<ul>
<li><a class="secm_link" href="docs/internal/doxygen.html">Doxygen</a></li>
<li><a class="secm_link" href="docs/internal/extensions.html">Extensions</a></li>
<li><a class="secm_link" href="#">Error Recovery</a></li>
<li><a class="secm_link" href="#">Late Binding</a></li>
</ul>
</div>
<div class="column">
<div class="column_header">End User</div>
<ul>
<li><a class="secm_link" href="#">User Manual</a></li>
<li><a class="secm_link" href="#">Status of ObjectiveC[++]</a></li>
</ul>
</div>
</div>
</div>
</li>
<li><a class="tab_link" href="contact.html">Get Involved</a></li>
</ul>
</div>
</div>
<div id="breadcrumb"></div>
<div id="content">
<div class="sidebar">
<!-- insert your sidebar items here -->
<h3>Latest News</h3>
<h4>Cling goes public</h4>
<h5>July 25th, 2011</h5>
<p> Cling was officially announced to the Clang community <br /><a href="news/ClingAnnouncement.html">Read more</a></p>
<p></p>
<h4>New website launched</h4>
<h5>July 1st, 2011</h5>
<p> Welcome to the new website of the project. <br /><a href="news/NewWebsiteLaunched.html">Read more</a></p>
<h3>Useful Links</h3>
<ul>
<li><a href="www.cern.ch" target="_blank">CERN</a></li>
</ul>
</div>
<div id="main">
<!-- insert the page content here -->
<h1>Cling</h1>
<p>
Welcome to our interactive C++ interpreter, built on the top of LLVM and Clang libraries. Its advantages over the standard interpreters are that it has command line prompt and uses just-in-time (JIT) compiler for compilation. An interactive prompt is usually referred to as a read eval print loop or repl. Many of the developers (e.g. Mono in their project called CSharpRepl) of such kind of software applications name them interactive compilers.
</p>
<p>
One of Cling's main goals is to provide contemporary, high-performance alternative of the current C++ interpreter in the ROOT project - CINT. The backward-compatibility with CINT is major priority during the development.
</p>
<h2>How to use it</h2>
<p> You can start typing not only C++ top level declaratons but statements, too. </p>
<pre>**** Welcome to the cling prototype! ****
* Type C code and press enter to run it *
* Type .q, exit or ctrl+D to quit *
*****************************************
[cling]$</pre>
<p>
Statements and expressions could take more than one input line. The interactive prompt changes from "[cling]$" to "[cling]$ ?".
</p>
<pre>[cling]$ #include "math.h"
[cling]$ #include "stdio.h"
[cling]$ for (unsigned i = 0; i < 5; ++i) {
[cling]$ ? printf("%f\n", sin(i));
[cling]$ ? }
0.000000
0.841471
0.909297
0.141120
-0.756802</pre>
<h2>Grammar</h2>
<p>Cling is able to parse everything that clang can. Current clang status can be found <a href="http://clang.llvm.org/cxx_status.html">here</a>. At the moment, there are use cases only for C++ that's why cling is best in working with C++. Clang has support of C, objC, objC++ and we are looking forward to having more use-cases and extend our tool in that direction.</p>
<ul>Cling has internal commands, which can change its behavior at runtime. Those commands usually start with dot (.):
<li><b>.I &lt;path&gt;</b> - Adds an include path;</li>
<li><b>.x &lt;filename&gt;</b> - #include-s the filename; and calls function called filename(); </li>
<li><b>.L &lt;libname&gt;</b> - Loads libname or #include-s the libname if libname is file;</li>
<li><b>.@</b> - Cancels the multiline input;</li>
<li><b>.printAST</b> - (DEBUG ONLY) Turns on the printing of the compiler's abstract syntax tree (AST);</li>
<li><b>.dynamicExtensions</b> - Turns on cling's dynamic extensions. This in turn enables the dynamic lookup and the late resolving of the identifier. With that option cling tries to heal the compile-time failed lookups at runtime;</li>
</ul>
<h2>Details</h2>
<h3>Command line</h3>
<p>
The interactive prompt supports an emacs-like command line editor, just like bash terminal, which makes it easy to integrate and use. Cling uses <a href="http://root.cern.ch/drupal/content/textinput-prompt">TextInput</a> and doesn't depend on ncurses.
</p>
<p>
Autocompletion should be coming soon!
</p>
<h3>#Include Declarations</h3>
<p>
Cling allows #include-s to be not only before the declarations. The includes could be mixed with other declarations. For example:
<pre>[cling]$ #include "math.h"
[cling]$ sin(1)
(double const) 8.414710e-01
[cling]$ #include "stdio.h"
[cling]$ printf("%f\n", sin(1));
0.841471</pre>
</p>
<p>
More statements could be combined using semicolon (;). This doesn't stay when the command is <b>#include</b>
The following example is invalid:<pre>[cling]$ #include "math.h"; sin(1)</pre>
</p>
<p>
The same rules are applicable for the other preprocessor directives (commands starting with <b>#</b> - such as #define)
</p>
<h3>Variable Declarations</h3>
<p>
Cling allows statements to be entered onto the global scope. In order to be compiled and executed by the compiler these statements need to be wrapped into functions, which body contains the statement and afterwards to run the function. The semantics of the statements that declare variables is that variables should be accessed by other statements. If the statement that declare variable is wrapped into function the variables won't be accessible from outside anymore. In this case variables are extracted onto the global scope.
</p>
<p>TODO: There should be dedicated entry for that in the docs</p>
<h3>Builtins</h3>
Cling starts with very few builtins loaded. Users could extend the available builtins via extending the RuntimeUniverse.h, which is loaded at cling's startup.
</div>
</div>
<div id="footer">
<div id="copyright">
Copyright &copy; Cling Team
</div>
<div id="links">
<a href="http://root.cern.ch/" target="_blank">The ROOT Framework</a> |
<a href="http://llvm.org" target="_blank">LLVM</a> |
<a href="http://clang.llvm.org" target="_blank">Clang</a> |
<a href="http://www.html5webtemplates.co.uk" target="_blank">Web Design</a>
</div>
<div id="modified"><i>Page was modified on <b>$Date$</b> in $Rev$ by <b>$Author$</b></i></div>
</div>
</div>
</body>
</html>