Live DemoDocumentationDownloadsDonateIO Ninja

Introducing Jancy

What?! Yet another programming language? Like, there isn't enough of them already?

Believe us, we likely know every possible argument against creating a new programming language. But the truth is, Jancy was NOT created just to fix the infamous fatal flaw of other languages (a.k.a., they didn't write it)— although we admit that the passion to invent was a significant driving force.

The main motivation to create Jancy was our software product called IO Ninja.

What we needed was a scripting language with safe data pointer arithmetic, extensive facilities for UI programming (properties, events, etc.), and easy integration with the host C/C++ application.

We couldn't find such a language! So we created it. Meet Jancy.

Main design goals

  • Statically typed C-family scripting language for IO and UI programming
  • Seemless embedding into the host C/C++ application
  • High level ABI and source compatibility with C
  • Automatic memory management via accurate GC
  • LLVM as a back-end

Open-source

Jancy is an open-source project hosted on GitHub under the MIT license — one of the most permissive licenses in existence. Visit Jancy GitHub page for more details.

DownloadDownload JANCYJancy Scripting Language

Key Language Features

Jancy scripts are JIT-compiled and can be called directly from the host C/C++ application. Jancy supports all of the major calling conventions and is compatible with C/C++ compilers with respect to struct/union layouts with arbitrary packing factors.

Jancy provides all the colors and flavors of pointers such as safe pointers and safe pointer arithmetic, unsafe thin pointers for interoperability with existing C/C++ libraries, weak pointers which do not retain objects, function pointers with partial application, scheduled function pointers and even property pointers!

Ever used Microsoft Excel before? Then you know the concept of writing a "formula" which will be automatically re-evaluated when the referenced cells change. With Jancy you can do the same in your code — and with full control of where and when to use this reactive paradigm. This is perfect for UI programming!

Jancy provides a convenient way of tokenizing input streams — that is, splitting a stream of characters into a token sequence. Specify regular expressions to define recognized lexemes and then simply write actions to execute when these lexemes are matched in the input stream!

If you ever written a parser for a binary protocol, you know how often the length of a field is dynamically calculated from the values of others. Jancy allows declaring structs with non-const sized array fields, and then use those structs for both!

Both error code checks and exceptions have their preferred domains of applications. Jancy allows you to create APIs which support both! Define a function once, and then choose whether it's more convenient to error-check or use exception semantics at each particular call-site!

Other Notable Features

Jancy features one of, if not the most, comprehensive implementation of properties. Along with the natural syntax for simple properties there is support for properties with overloaded setters, indexed properties, bindable properties, auto-get properties, and property pointers.

Jancy supports multicasts and events which allow accumulating function pointers and then calling them all at once. Weak multicasts and events which do not require explicit unsubscribing are also supported, thus providing an out-of-the-box solution for the publisher-subscriber pattern.

This function pointer-related feature simplifies the development of asynchronous multi-threaded applications. Jancy provides a natural syntax for creating callback function pointers, which are guaranteed to be executed in the proper context (e.g. in a worker thread, with a lock held, as a Windows message handler, etc.)

Jancy provides a very intuitive approach for ensuring the deterministic resource release in an inherently non-deterministic GC-world. Local variables declared with disposable storage specifier will have their dispose () method called upon exiting the scope — no matter which exit route was taken!

Besides standard class features such as constructors, destructors, virtual methods, and namespace member access control, Jancy also supports multiple inheritance, in- and out-of-class method implementation, operator overloading, in-place field initialization and preconstructors.

Const-correctness is a yin to the yang of data pointers. It is a great feature, which not only detects a whole range of logical errors at compilation time but also helps to design better and more foolproof libraries and APIs. Const-correctness is left behind in way too many languages. Jancy restores justice by bringing it back.

Jancy features special "dual" modifiers, the meaning of which depends on the context. They allow natural declarations for such common design patterns as read-only fields and events. No more writing dummy public getters for private fields!

Beside traditional C character literals, Jancy features new kinds thereof. There are binary literals for a convenient HEX-view definition of in-program binary blobs. There are formatting literals (as in perl-style formatting). There are raw literals which do not process escape-sequences. And there are multi-line literals! All kinds of literals can be concatenated in any combinations.

Bitflag enums are just like enums... but for flag constants. Bitflag enums are missing in most modern languages and usually require some not-so-trivial workarounds. Jancy provides a solution for flag enums out-of-the-box.

Jancy allows you to extend functionality of existing classes without subclassing. Create an extension namespace for a class, implement necessary methods/properties (in which you can access all the protected members of the class), and then "turn it on" with the using directive — now you can access the new methods just as if they were part of the original class!

Live DemoDocumentationDownloadsDonateIO Ninja