GithubHelp home page GithubHelp logo

pkukielka / clad Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 512 KB

Standalone Clang service for easier integration with various editors and IDEs

Home Page: http://pkukielka.github.com/clad/

C 0.56% JavaScript 24.05% C++ 75.39%

clad's Introduction

Clad

Standalone Clang service for easier integration with various editors and IDEs

About

The goal of Clad is to provide platform independent, persistent service which provides API very similar to libclang C API, but can be accessed easily from any programming language without need to write C bindings.
This should significantly simplify process of building stateless commandline utilities based on Clang (state is moved to service instead, you don't need to reparse all files every time you run your tool) as well as testing Clang using other languages, even exotic ones.

Demo

In the 'example' directory you can find demo of in-browser C++ editor built with Clad and javascript client.
To run it you need to compile and run Clad server, and then start web server in the 'example' directory:

~/clad/build/src$ ./clad_serv &
~/clad/example$ python -m SimpleHTTPServer 8080

For now functionality is limited to marking errors in the code and showind diagnostic messages,
but I'm planning to add fix-its and live-completion as well. So far it looks like this:
alt text

Building the server

To build Clad you need to have:

  • Clang 3.2
  • CMake 2.6
  • Thrift 0.9
  • GTest 1.6

You don't need to have full Clang installation but CMake must be able to find libclang 3.2 headers and library. If you will try to use other Clang version there is high chance that it wont compile or will break on runtime.
Your Thrift and GTest versions can be different, but I cannot guarantee that it will work then.
Building Clad is pretty straightforward:

~/$ git clone https://github.com/pkukielka/clad.git  
~/$ cd clad && mkdir build && cd build  
~/clad/build$ cmake ..  
~/clad/build$ make

You can also run tests to ensure that everything works as intended:

~/clad/build$ make test

Client API

Clients APIs are not part of the Clad distribution because of two reasons:

  • there is ~14 languages supported, a it too many to manage them easily (you can find full list inside Thrift documentation: http://thrift.apache.org/docs/features/)
  • it's very easy to generate all the files:
~/clad/build$ thrift -r --gen java ../thrift/Clang.thrift

This will generate full API for java. To see list of all available generators open terminal and type:

thrift -help

##Roadmap Plan for now looks like that:

  • Finish demo of using Clad with javascript
  • Add missing libclang API functions (like for cursors)
  • Cover existing Clad API with tests; also do some performance checks
  • Experiment with libtooling, clang refactoring tools, etc.
  • Add posibility to dynamically load C/C++ scripts to the server (so you can add refactorings on the fly)

I would say it can take another month to cover first 3 points.

clad's People

Contributors

pkukielka avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

coolya

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.